
//Function for Index page. When selecting a Honda

//find model index
function getModelIndex(modelname, modelyear) {
var MIndex = 0;
    for (i=0;i<models.length;i++) {
        if (modelname == models[i][0] && modelyear == models[i][1]) {
            MIndex = i+1;
        }
    }
return MIndex;
}

function UpdateTrim() {
    $("#priceTag").hide();
    modelname = $('#ModelSelector option:selected').val();

    if (modelname == 0) {
        clearOption(document.getElementById("TrimSelector"));        
        addOption(document.getElementById("TrimSelector"),"Select a Model",0);
        document.getElementById("ttlTransmission").style.display = 'none';
        document.getElementById("tblTransmission").style.display = 'none';
        helpLevel = 0;
        $("#Layer2").animate({marginTop: "160px"}, 1000, "easeOutBounce");
        ActiveColorLink(0);
        return false;
    }
    $("#loadingScreen").show();
    $("#Layer2").hide();
    $("#ModelSelector").hide();
    $("#TrimSelector").hide()
    productyear = models[document.getElementById('ModelSelector').selectedIndex - 1][1]
    $("#jsblock").load('/handlers/tools/shopping/GetProductLineJSArray.ashx?ModelName=' + escape(modelname) + '&ModelYear=' + productyear,function(data) {
            clearOption(document.getElementById("TrimSelector"));
            for (var i=0; i < trimList.length;i++){
                var varRet = trimList[i][0].replace(/\&#153;/g,'™');
                varRet = varRet.replace(/\&trade;/g,'™');
                varRet = varRet.replace("<sup>", "");
                varRet = varRet.replace("</sup>", "");
                addOption(document.getElementById("TrimSelector"), varRet,i);
            }
            if (modelid.length > 0) {
            var trimIndex = 0;
            for (var i=0;i<modelList.length;i++) {
                if (modelid.toLowerCase() == modelList[i][1].toLowerCase()) {
                    trimIndex = modelList[i][0];
                }
            }
            $("#TrimSelector option[index='"+trimIndex+"']").attr('selected', 'selected');
            }
            updateTransmission();
    });
    helpLevel = 1;
}
//Function for Index page. When Selecting a transmission.
function updateTransmission() {
    $("#priceTag").hide();
    document.getElementById("ttlTransmission").style.display = '';
    document.getElementById("tblTransmission").style.display = '';
    trimID = $('#TrimSelector option:selected').val();
    var transmissionText = '<table style="font-size:12px;" style="wrap"><tr>';
    TempModels = new Array();
    var selected = false;
    var k = 0;
    for (var m=0; m<modelList.length;++m) {
        if (modelList[m][0] == trimID) {
        TempModels[k] = modelList[m];
        k++;
        }
    }
    transmissionText += '<td width="220">';
    var TransIndex = 0;
    for (var i=0; i < TempModels.length;++i){
        transmissionText += '<div class="Transimissions"><input id="trans'+i+'" name="transOptions" type="radio" onclick="CallPriceTag('+i+');" value="' + TempModels[i][1] + '"';

        if (modelid.toLowerCase() == TempModels[i][1].toLowerCase()) {
           transmissionText += ' checked'
           TransIndex = i;
           selected = true;
        }
        transmissionText += '/> <label for="trans'+i+'">'+ TempModels[i][4] + '</label></div>';
    }
    transmissionText += '</td>';
    transmissionText += '</tr></table>';
    document.getElementById("tblTransmission").innerHTML = transmissionText;
    if (selected == false) { $('#trans0').attr("checked", "checked"); }
    ActiveColorLink(0);
    CallPriceTag(TransIndex);
    ShowCarPhoto(TempModels[0][1]);
    $("#loadingScreen").hide();
    $("#Layer2").show();
    $("#ModelSelector").show();
    $("#TrimSelector").show()
    $("#Layer2").animate({marginTop: "210px"}, 1000, "easeOutBounce");
}

function CallPriceTag(key) {
    $("#priceTag").show();
    var TrimIndex = $('#TrimSelector option:selected').val();
    setPriceTag(TempModels[key][2], TempModels[key][3],productyear, trimList[TrimIndex][3], DedupeModelTrim(trimList[TrimIndex][3], trimList[TrimIndex][0]), TempModels[key][4], $("input[@name='transOptions']:checked").val(),true);
    
    ShowPricetag();
    ActiveColorLink(1);
    
    var stTransmissionName = TempModels[key][4];
    var stWheelDrive = '';
    stTransmissionName = ExtractTransmissionInfo(stTransmissionName , stWheelDrive);
    stTransmissionName = ExtractTransmissionInfo(stTransmissionName , stWheelDrive);
    stWheelDrive = stTransmissionName.split('|')[1];
    stTransmissionName = stTransmissionName.split('|')[0];            

    
    // Tracking
    s.pageName = 'RAQ - MODEL & TRIM SELECTED';
    s.channel = 'RAQ';
    s.prop1 = trimList[TrimIndex][3].toUpperCase();
    s.prop2 = productyear;
    s.prop5 = stWheelDrive + trimList[TrimIndex][0].toUpperCase();
    s.prop26 = 'VEHICLE';
    s.prop27 = 'DEFAULT';
    s.prop33 = stTransmissionName;
    s.prop37 = 'RAQ:VEHICLE:DEFAULT:RAQ - MODEL & TRIM SELECTED';
    s.products = GetModelProductType(s.prop1) + ':' + s.prop1;
    
    
    CallSDotT(s);

}
    
    
function ActiveColorLink(key) {
if (key > 0) {
    $("#NextColor").html('<a href="javascript:ToColorsPage(\'btn\');"><img src="/images/tools/request-a-quote/btn-next-select-colors-off.png" id="btnNextColor" onmouseover="SwitchImg(\'btnNextColor\', \'/images/tools/request-a-quote/btn-next-select-colors-over.png\')" onmouseout="SwitchImg(\'btnNextColor\', \'/images/tools/request-a-quote/btn-next-select-colors-off.png\')" width="191" height="27" border="0" /></a>');
    }
    else
    {
    $("#NextColor").html('<img src="/images/tools/request-a-quote/btn-next-select-colors-disabled.png" onmouseover="" onmouseout="" width="191" height="27" border="0" />')
    }
}
   
//This function is made for the button to hovers next to the select boxes.
//Depending on where it is, it will take you to different locations.
var helpLevel = 0;
function helpClicked() { 
    if ( dealerID != "" ) { dealerID = 'DealerID=' + dealerID }
    switch(helpLevel) {
    case 0: 
        window.location = '/tools/request-a-quote/models.aspx?' + dealerID; 
        break;
    case 1: 
        var DID = '';
        if (dealerID != "") { DID = dealerID + "&";}
        window.location = '/tools/request-a-quote/trims.aspx?' + DID + 'ModelName='+ modelname +'&ModelYear='+productyear;
        break;
    }
} // End helpClicked()

function ToColorsPage(source) {

    var oValidation= new Validation();
    var zip = $('#CustomerZip').val();
    if($("#ModelSelector").val() == 0) {
        alert("Please select a vehicle");
    } else if (!oValidation.IsZip(zip)) {
        alert('Please enter a valid zip code')
    } else {
        SetUserZip(zip);
        if ( dealerID != "" ) { 
            dealerID = '&DealerID=' + dealerID 
        }
        
        // Tracking
        s.linkTrackVars = 'prop26,prop27,prop37,eVar26,eVar27';
        s.prop26 = 'VEHICLE';
        s.prop27 = 'FORWARD';
        s.prop37 = 'RAQ:VEHICLE:DEFAULT:RAQ - MODEL & TRIM SELECTED';
        if (source == 'btn') {            
            CallSDotTL(s , true , 'RAQ:VEHICLE:FORWARD:NEXT:SELECT COLORS LINK' , 'o');
        } else if (source == 'tabs') {
            CallSDotTL(s , true , 'RAQ:VEHICLE:FORWARD:COLORS TOP NAV LINK' , 'o');
        }

        
        window.location = '/tools/request-a-quote/colors.aspx?ModelName='+modelname+'&ModelYear='+productyear+'&ModelID='+$("input[@name='transOptions']:checked").val() + dealerID;
    }

}

/* ------- Geo Targeting ------ */
// GetUserZip takes a parameter, bUseGeotargeting - This will determine if geotargeting should be done on the user or not if the ZIP code cookie is not present.
function GetUserZip(bUseGeotargeting){
    var customerzip = null;
    
    customerzip = GetCookie("customerzip");
    var iptargeted = GetCookie("iptargeted")
    if (customerzip == "null" || customerzip == null) {
        customerzip = '';
    }


    if ( (customerzip == '') && (!iptargeted) && (bUseGeotargeting) ) {       
        $.ajax({
            url:        "/handlers/tools/shopping/getuserzip.ashx",
            timeout:    10000,
            async:      false,
            complete:   function(XMLHttpRequest, textStatus){
                            if (textStatus == "success"){
                                // Set cookie to indicate that IP address was geotargeted so we don't have to call the service over and over if no ZIP was located.
                                SetCookie("iptargeted", "true");
                                customerzip = XMLHttpRequest.responseText;
                                // Only set cookie if a zip was found                                
                                if ( (customerzip != null) && (customerzip != "null") && (customerzip != "") ) {
                                    SetUserZip(customerzip);
                                }
                            }
                        }
        });
    }
    
    return (customerzip == "null" || customerzip == null) ? "" : customerzip;

}

function SetUserZip(sUserZip) { 
    var oDate = new Date();
    oDate.setDate(oDate.getDate() + 30); //30 day duration                                
    SetCookie("customerzip", sUserZip , oDate); 
}

Array.prototype.remove = function(from, to) {
  var rest = this.slice((to || from) + 1 || this.length);
  this.length = from < 0 ? this.length + from : from;
  return this.push.apply(this, rest);
};

Array.prototype.contains = function(element){
    for(var i=0;i<this.length;i++){
        if (this[i] == element){ return true; }
    }
    return false;
};



function documentDotLocation(sLocation) {
      var oBody = document.getElementsByTagName("body")[0];
      var oNewDiv = document.createElement('div');
      oNewDiv.innerHTML = '<a href="' + sLocation +'" id="HiddenClickDiv">_</a>';
      oNewDiv.setAttribute('style' , 'visibility: hidden');

      oBody.appendChild(oNewDiv);

      var oDiv = document.getElementById('HiddenClickDiv');

      // Firefox doesn't seem to support click(), but it does support referrer
      if (oDiv.click) {
            oDiv.click();
      } else {
            document.location = sLocation;
      }
}


//OnMouseOut will be falsely triggered if you're mousing to a child of the element
//that has fired the OnMouseOut.  However, you probably only want the event fired
//if the user is leaving the whole control, not the literal element.  Pass the event
//and the ID of the element containing the event, and this function will return 'true'
//if the mouse has really left the control (and all its children).
function IsNotAChildOf(e, potentialParentID){
    var toElement = (e.relatedTarget) ? e.relatedTarget : e.toElement;
    if (toElement){
        var parent = toElement.parentNode;
        while (parent && parent.nodeName != "BODY" && parent.id != potentialParentID){
            parent = parent.parentNode;
        }
        if (parent && parent.id != potentialParentID){
            return true;
        }
    }
    return false;
}




function GetCarImageSize(sSrc , iWidth , iHeight) {

    aSrcParts = sSrc.split("/");

    if (aSrcParts[1] != "images") {
        return sSrc;
    }

    // We only have new paths for 2009 cars and beyond
    if ( (!parseInt(aSrcParts[2])) || (aSrcParts[2] < 2009) ) {
        return sSrc;
    }
    

    // 500x450: Default size for base cars and accessory overalys
    if ( (iWidth == 500) && (iHeight == 450) ) {
        return sSrc;
    }
    
    // 300x245: Accessories for 300x200 base cars
    if ( (iWidth == 300) && (iHeight == 245) ) {
        aSrcParts[4] = 'configurations';
        aSrcParts[5] = 'accessories';
        var sTmp = aSrcParts[aSrcParts.length - 1];
        aSrcParts[aSrcParts.length - 1] = "300x245";
        aSrcParts[aSrcParts.length] = sTmp;
        var sTmp = aSrcParts[aSrcParts.length - 1];
        sTmp = sTmp.replace(".jpg" , ".png");
        aSrcParts[aSrcParts.length - 1] = sTmp;
        sSrc = aSrcParts.join("/");
        return sSrc;
    }

    // 300x200: Base cars
    if ( (iWidth == 300) && (iHeight == 200) ) {
        aSrcParts[4] = 'configurations';
        aSrcParts[5] = 'base-cars';
        var sTmp = aSrcParts[aSrcParts.length - 1];
        sTmp = sTmp.replace(".png" , ".jpg");
        aSrcParts[aSrcParts.length - 1] = "300x200";
        aSrcParts[aSrcParts.length] = sTmp;
        sSrc = aSrcParts.join("/");
        return sSrc;
    }

   // 140x90: Base cars
    if ( (iWidth == 140) && (iHeight == 90) ) {
        aSrcParts[4] = 'configurations';
        aSrcParts[5] = 'base-cars';
        var sTmp = aSrcParts[aSrcParts.length - 1];
        sTmp = sTmp.replace(".png" , ".jpg");
        aSrcParts[aSrcParts.length - 1] = "140x90";
        aSrcParts[aSrcParts.length] = sTmp;
        sSrc = aSrcParts.join("/");
        return sSrc;
    }

}


function SubSelection(TargetSelector,SelectorName) {
   var SelectedValue = document.getElementById(SelectorName).value;
   var thisSelected;
   clearOption(document.getElementById(SelectorName));
     for (var i=document.getElementById(TargetSelector).selectedIndex; i < document.getElementById(TargetSelector).options.length;i++){
       thisSelected = ( document.getElementById(TargetSelector).options[i].value == SelectedValue ? true : false )
       addOption(document.getElementById(SelectorName), document.getElementById(TargetSelector).options[i].text,document.getElementById(TargetSelector).options[i].value,thisSelected);
    }
}

function clearOption(selectbox){
  for (var i=selectbox.options.length-1; i>=0; i--){
    selectbox.options[i] = null;
  }
  selectbox.selectedIndex = -1;
}

function addOption(selectbox,text,value,selected) {
    var optn = document.createElement("option");
    optn.text = text;
    optn.value = value;
    if(selected == true) {
        optn.selected = true;
    }
    selectbox.options.add(optn);
}

//GENERAL
function SetCanvas(folderName , modelYear){
    var modelFolderPath = "/images/" + modelYear + "/" + folderName;
    $("#canvasHeader").attr("src", modelFolderPath + "/headers/build-price.jpg");
    $("body").css({background: "url(" + modelFolderPath + "/background.jpg) repeat-x"});
}

function showPrevConfigs(){
    $("#prevConfigsPopup").css({display: "block"});
    setTimeout(function(){$("#prevConfigsPopup").animate({marginTop: "0px"}, 700);}, 300);
}

function retractPrevConfigs(callback){
    setTimeout(function(){
        $("#prevConfigsPopup").animate({marginTop: "-100px"}, 500, callback);
    }, 10);
}

function StartOver(source){
    tb_show("", "#TB_inline?height=180&width=400&inlineId=startoverPopup&modal=true", "");
    $(".TB_modal").css({padding: "0px"});
    $("#TB_window").css({width: "400px"});
    
    // Tracking 
    switch (source) {
        case 'trim':
            s.linkTrackVars = 'prop26,prop27,prop37,eVar26,eVar27';
            s.prop26 = 'MODEL';
            s.prop27 = 'RESET';
            s.prop37 = 'BUILD & PRICE:MODEL:DEFAULT:B&P - SELECT A MODEL';
            CallSDotTL(s , true , 'BUILD & PRICE:MODEL:RESET:START OVER LINK' , 'o');
            break;
        case 'color':
            s.linkTrackVars = 'prop26,prop27,prop37,eVar26,eVar27';
            s.prop26 = 'COLORS';
            s.prop27 = 'RESET';
            s.prop37 = 'BUILD & PRICE:COLORS:DEFAULT:B&P - SELECT COLORS';
            CallSDotTL(s , true , 'BUILD & PRICE:COLORS:RESET:START OVER LINK' , 'o');
            break;
        case 'accessories':
            s.linkTrackVars = 'prop26,prop27,prop37,eVar26,eVar27';
            s.prop26 = 'ACCESSORIES';
            s.prop27 = 'RESET';
            s.prop37 = 'BUILD & PRICE:ACCESSORIES:DEFAULT:B&P - SELECT ACCESSORIES';
            CallSDotTL(s , true , 'BUILD & PRICE:ACCESSORIES:RESET:START OVER LINK' , 'o');
            break;
    }

}

//SUMMARY PAGE
function LoadModelInfoForDisplay(){
    var exColorIndex = 0;
    var inColorIndex = 0;
    for(var x=0;x<=exColorList.length-1;++x){
        if (exColorList[x][1] == sEColor){
            exColorIndex = x;
        }
    }
    for(var x=0;x<=inColorList.length-1;++x){
        if (inColorList[x][1] == sIColor){
            inColorIndex = x;
        }
    }
    
    //LEFT COLUMN - INFO
    var exColorName = "";
    var inColorName = "";
    $.each(exColorList, function(){
        if (this[6] == sEColor){
            exColorName = this[0];
        }
    });
    $.each(inColorList, function(){
        if (this[1] == sIColor){
            inColorName = this[0];
        }
    });
    $("#trimName").html("<div class=\"subTitle\">" + sModelYear + " " + trimList[0][3] + " " + DedupeModelTrim(trimList[0][3], trimList[0][0]) + "</div><div style=\"margin-top: 2px; text-align: right;\"><b>" + removeDecimal(modelList[0][2]) + "</b>&nbsp;&nbsp;&nbsp;<div class=\"clr\"></div></div>");
    $("#colorNames").html("<div class=\"subTitle\">Exterior: " + exColorName + "<br />" + "Interior: " + inColorName + "</div><div><div class=\"clr\"></div></div>");
    $("#dhCost").html(removeDecimal(modelList[0][3]));
    
    var accHtml =  $("#accContainer").html();
    if (sSelected != ""){
        var accSplit = sSelected.split(",");
        var pkgAccHtml = "<div class=\"lineItem\"><b class=\"big\">Package</b></div>";
        var exAccHtml = "<div class=\"lineItem\"><b class=\"big\">Exterior</b></div>";
        var inAccHtml = "<div class=\"lineItem\"><b class=\"big\">Interior</b></div>";
        var electAccHtml = "<div class=\"lineItem\"><b class=\"big\">Electronic</b></div>";
        var eccm = ConstructModel(ConfigurableModelJSON, sModelID, sEColor, sIColor, sSelected.split(","));
        var oModel = eccm.GetModel(sModelID);
        $.each(accSplit, function(){
            var accId = this;
            var accFound = false;
            $.each(packageList, function(){
                if (this[1] == accId){
                    accFound = true;
                    pkgAccHtml += "<div class=\"lineItem\"><div class=\"title\">" + this[0] + "</div><div style=\"text-align: right;\"><b>" + removeDecimal(this[2]) + "</b></div><div style=\"margin-top: 5px;\">";
                    
                    $.each(oModel.ModelOptionPackageList, function(){
                        if (this.OpCode == accId){
                            var accArrays = exteriorAccList.concat(interiorAccList, electronicAccList);
                            $.each(this.IncludedOptionsList, function(){
                                var includedAccId = this.OpCode;
                                $.each(accArrays, function(){
                                    if (this[1] == includedAccId){
                                        pkgAccHtml += "<div style=\"text-indent: 20px;\">" + this[0] + "</div>";
                                        return false;
                                    }
                                });
                            });
                        }
                    });
                    
                    pkgAccHtml += "</div></div>";
                    return false;
                }
            });
            if (!accFound){
                $.each(exteriorAccList, function(){
                    if (this[1] == accId){
                        accFound = true;
                        exAccHtml += "<div class=\"lineItem\"><div class=\"title\">" + this[0] + "</div><div style=\"text-align: right;\"><b>" + removeDecimal(this[2]) + "</b></div></div>";
                        return false;
                    }
                });
            }
            if (!accFound){
                $.each(interiorAccList, function(){
                    if (this[1] == accId){
                        accFound = true;
                        inAccHtml += "<div class=\"lineItem\"><div class=\"title\">" + this[0] + "</div><div style=\"text-align: right;\"><b>" + removeDecimal(this[2]) + "</b></div></div>";
                        return false;
                    }
                });
            }
            if (!accFound){
                $.each(electronicAccList, function(){
                    if (this[1] == accId){
                        accFound = true;
                        electAccHtml += "<div class=\"lineItem\"><div class=\"title\">" + this[0] + "</div><div style=\"text-align: right;\"><b>" + removeDecimal(this[2]) + "</b></div></div>";
                        return false;
                    }
                });
            }
        });
        
        var addHtml = "";
        if (pkgAccHtml != "<div class=\"lineItem\"><b class=\"big\">Package</b></div>"){
            addHtml += pkgAccHtml;
        }
        if (exAccHtml != "<div class=\"lineItem\"><b class=\"big\">Exterior</b></div>"){
            addHtml += exAccHtml;
        }
        if (inAccHtml != "<div class=\"lineItem\"><b class=\"big\">Interior</b></div>"){
            addHtml += inAccHtml;
        }
        if (electAccHtml != "<div class=\"lineItem\"><b class=\"big\">Electronic</b></div>"){
            addHtml += electAccHtml;
        }
        $("#accContainer").html(accHtml + addHtml + "<br />");
    }else{
        $("#accContainer").html(accHtml + "<div class=\"txtDiv1\"><div class=\"subHeader\">You did not add any accessories.</div></div><br />");
    }
    
    //MIDDLE COLUMN - PHOTOS
    ShowCarPhoto("", sEColor, sIColor, true);
    setTimeout(function(){
        AddRemoveAccOverlays(true);
    }, 100);
    
    $("#interiorPhoto").html("<img src='" + inColorList[inColorIndex][3] + "' width='300px' />");    
    
    //RIGHT COLUMN - OTHER INFO
    $("#similarModels").html("Similar " + trimList[0][3] + " Models");
    for (var i = 0; i < similarModelList.length; i++) {
        if (i == 1) {
            $("#similarList")[0].innerHTML += '<br />';
        }
        $("#similarList")[0].innerHTML += "<a href=\"colors.aspx?ModelName=" + sModelName + "&ModelYear=" + sModelYear + "&ModelID=" + similarModelList[i][0] + "\"  onclick=\"TrackBNPClick(s , 'BUILD & PRICE:SUMMARY:NEW B&P:BUILD A SIMILAR MODEL LINK' , 'SUMMARY' , 'NEW B&P' , 'prop1,prop2,prop5,prop33,products,eVar10,eVar11,eVar14,eVar16');\">" + similarModelList[i][1] + " (" + removeDecimal(similarModelList[i][2]) + " )</a>";
    }

    
    
    // Confirmation
    $("#similarModels2").html("Similar " + trimList[0][3] + " Models");
    
    for (var i = 0; i < similarModelList.length; i++) {
        if (i == 1) {
            $("#similarList2")[0].innerHTML += '<br />';
        }
        $("#similarList2")[0].innerHTML += "<a href=\"colors.aspx?ModelName=" + sModelName + "&ModelYear=" + sModelYear + "&ModelID=" + similarModelList[i][0] + "\"  onclick=\"TrackBNPClick(s , 'BUILD & PRICE:QUOTE:NEW B&P:BUILD A SIMILAR MODEL LINK' , 'QUOTE' , 'NEW B&P' , 'prop1,prop2,prop5,prop33,products,eVar10,eVar11,eVar14,eVar16');\">" + similarModelList[i][1] + " (" + removeDecimal(similarModelList[i][2]) + " )</a>";
    }
    
    $("#dlBroLink").html("Download the " + trimList[0][3] + " brochure (PDF)");
    $("#dlFsLink").html("Download the " + trimList[0][3] + " fact sheet (PDF)");
    $("#goHomeLink").html("Go to " + trimList[0][3] + " home page");
    $("#goHomeLink").attr("href", "/" + sModelFolderName);
    $("#dlBroLink2").html("Download the " + trimList[0][3] + " brochure (PDF)");
    $("#dlFsLink2").html("Download the " + trimList[0][3] + " fact sheet (PDF)");
    $("#goHomeLink2").html("Go to " + trimList[0][3] + " home page");
    $("#goHomeLink2").attr("href", "/" + sModelFolderName);
}

function BNPRequestAQuote(dealerId){
    var dealerInfo = "";
    var tyDealerInfo = "";
    var dealerName = "";
    
    var d = new Date();
    var weekday = new Array(7);
    weekday[0]="Sunday";
    weekday[1]="Monday";
    weekday[2]="Tuesday";
    weekday[3]="Wednesday";
    weekday[4]="Thursday";
    weekday[5]="Friday";
    weekday[6]="Saturday";
    
    var curr_hour = d.getHours();
    var curr_min = d.getMinutes()+"";
    var a_p = (curr_hour < 12) ? "AM" : "PM";
    if (curr_hour == 0){
        curr_hour = 12;
    }
    if (curr_hour > 12){
        curr_hour = curr_hour - 12;
    }
    if (curr_min.length == 1){
        curr_min = "0" + curr_min;
    }
    
    $.each(dealerList, function(){
        if (this[0] == dealerId){
            dealerInfo = "<b>" + this[1] + "</b><br/>" + this[4] + "<br/>" + this[5] + ", " + this[6] + " " + this[7].substr(0, this[7].indexOf("-")) +
                "<br/>" + this[3] + "<br/><a href=\"mailto:" + this[8] + "\">Contact Internet Manager</a>" + "<span id=\"chosenDealerId\" style=\"display: none;\">" + dealerId + "</span>";
            tyDealerInfo = "<b style=\"color: #000;\">" + this[1] + "</b><br/>" + this[4] + "<br/>" + this[5] + ", " + this[6] + " " + this[11] +
                "<br/>" + this[3] + "<br/><br/><b style=\"color: #000;\">Manager:</b><br/>" + this[7] + "<br/><br/><b style=\"color: #000;\">Request sent on:</b><br/>" +
                weekday[d.getDay()] + " " + (d.getMonth() + 1) + "/" + d.getDate() + "/" + d.getFullYear() + " " + curr_hour + ":" + curr_min + " " + a_p +
                "<span id=\"chosenDealerId\" style=\"display: none;\">" + dealerId + "</span>";
            dealerName = this[1];
        }
    });
    
    $("#raqDealerInfo").html(dealerInfo);
    $("#tyDealerData").html(tyDealerInfo);
    $("#dealerName3").html(dealerName);
    
    tb_show("","raq_preloader.aspx?width=612&height=447&TB_iframe=true&modal=true","");
    
    // Track Link
    var sOldProp26 = s.prop26;
    var sOldProp27 = s.prop27;
    var sOldProp37 = s.prop37;
    s.linkTrackVars = 'prop26,prop27,prop37,prop39,eVar7,eVar26,eVar27';
    s.prop26 = 'SUMMARY';
    s.prop27 = 'QUOTE REQUEST';
    s.prop39 = dealerId;
    CallSDotTL(s , true , 'BUILD & PRICE:SUMMARY:QUOTE REQUEST:REQUEST A QUOTE LINK' , 'o');
    s.prop26 = sOldProp26;
    s.prop27 = sOldProp27;
    s.prop37 = sOldProp37;

    
    // Track form
    s.pageName = 'B&P - QUOTE REQUEST';
    s.prop26 = 'QUOTE';
    s.prop27 = 'DEFAULT';
    s.prop37 = 'BUILD AND PRICE:QUOTE:DEFAULT:B&P - QUOTE REQUEST';
    s.prop39 = dealerId;
    s.eVar3 = 'B&P - QUOTE REQUEST';
    s.events = 'event7';
    CallSDotT(s);
}


//PRICE TAG
//
//These functions handle showing the shopping tool's price tag, as well as setting its text
function ShowPricetag(){
    $("#priceTag").animate({marginTop: "0px"}, 1000, "easeOutBounce");
}

function RetractPricetag(){
    $("#priceTag").animate({marginTop: "-200px"}, 500);
}

function FormatCurrency(sNum) {
        sNum = sNum.toString().replace(/\$|\,/g,'');
    	
        if(isNaN(sNum))
	        sNum = "0";
    	
        var sTemp = sNum;
    	
        var bSign = (Number(sNum) == (sNum = Math.abs(sNum)));
        sNum = Math.floor(sNum*100+0.50000000001);
        var sCents = sNum%100;
        sNum = Math.floor(sNum/100).toString();
    	
        if(sCents<10)
	        sCents = "0" + sCents;

        for (var i = 0; i < Math.floor((sNum.length-(1+i))/3); i++)
	        sNum = sNum.substring(0,sNum.length-(4*i+3))+ ',' + sNum.substring(sNum.length-(4*i+3));

        return (((bSign)?'':'-') + '$' + sNum + '.' + sCents);
    }
    
function setPriceTag(msrp, dhCost, ModelYear, ModelName, Trim, Trans,modelid,enableLeasing){
    setTimeout(function(){
        var priceTagContent = '';
        
        priceTagContent += "<div id='priceTagContent'>";
        priceTagContent += "<div class='priceTagLeft'>";        
        priceTagContent += "<div class='priceTagTitle'>" + ModelYear + " " + ModelName + "&nbsp<span class='mname'>" + DedupeModelTrim(ModelName,Trim) + "</span></div>";
        priceTagContent += "<div class='priceTagTransmission'>" + Trans + " Transmission</div>";
        priceTagContent += "<div class='priceTagStandardFeatures'><a href='javascript:standardFeatures(\"" + ModelName + "\", \"" + ModelYear + "\",\"" + modelid + "\");'>Standard Features</a></div>";
        priceTagContent += "</div>";
        
        priceTagContent += "<div class='priceTagRight'>";
        priceTagContent += "<div class='priceTagPrice' id='priceTagPrice'>" + removeDecimal(calcMsrp(msrp, dhCost)) + "</div>";
        priceTagContent += "<div class='priceTagMSRPLabel'>Total MSRP<sup>[ 2 ]</sup></div>";        
        priceTagContent += "</div>";
        
        priceTagContent += "<div class='clr'></div>";
        priceTagContent += "<div class='monthlyPaymentDiv'>Monthly Payments &nbsp;&nbsp;&nbsp;&nbsp;<a href='javascript:EstimatePayments(\"" + modelid + "\", \"" + msrp + "\", \"" + "testing" + "\", \"" + dhCost + "\");'>Calculate</a> | <a id='showLink' href='javascript:priceTagInfoToggle();'>Show</a></div>";
        priceTagContent += "<div class='monthlyPaymentDiv' style='margin-left:190px;margin-top:5px;'><a href='javascript:priceTagInfoToggle();'><img id='imgToggle' src='/images/tools/finance-tools/arrow-show.gif' /></a></div>";
        
        priceTagContent += "<div class='priceTagCalculateField'>";
        priceTagContent += "<div class='tit'>Lease It</div>";        
        priceTagContent += "<div class='sub'>Estimated Monthly Payment</div>";        
        priceTagContent += "<div id='priceTagLeaseMonthly' class='calcPrice'>$---.--</div>";        
        priceTagContent += "</div>";
        
        priceTagContent += "<div class='priceTagCalculateField' style='margin-left:15px;'>";
        priceTagContent += "<div class='tit'>Finance It</div>";        
        priceTagContent += "<div class='sub'>Estimated Monthly Payment</div>";        
        priceTagContent += "<div id='priceTagFinanceMonthly' class='calcPrice'>$---.--</div>";        
        priceTagContent += "</div><div id='CompareResults'></div>";
        
        priceTagContent += "</div>";
        priceTagContent += "<div><img src='/images/tools/shopping/pricetag-bottom.gif'></div>";
        
        $("#priceTag").html(priceTagContent);
        EstimatePayments(modelid,msrp,"",dhCost,ModelName);
    }, 100);
    
}


//PAYMENT ESTIMATOR
function EstimatePayments(modelid,price,title,dhCost,mGroup){
    if ( title == "" ) {
        var CVars = new CalcVars(mGroup);
        CVars.load();

        $("#CompareResults").load('/handlers/tools/shopping/comparecalculator.ashx?msrp='+ price +'&fterm='+ CVars.FTerm +'&lterm='+CVars.LTerm+'&downpayment='+CVars.DownPayment+'&mileage='+CVars.Mileage+'&apr='+CVars.APR+'&modelid='+modelid+'&tradein='+ CVars.TradeInVal +'&owed='+CVars.TradeInOwed + '&dc=' + dhCost, function(data) {
            if (CalResult[0][0] == '0') { 
                $("#priceTagLeaseMonthly").html( "$" + CalResult[0][2]);
                $("#priceTagFinanceMonthly").html( "$" + CalResult[0][1]);
                if ( CalResult[0][1] == '0' ) parent.$(".priceTagFinanceMonthly").html("$--");
                if ( CalResult[0][2] == '0' ) parent.$("#priceTagLeaseMonthly").html("$--");                
            } else {
                $("#ErrorMsg").html(CalResult[0][1]);
            }
        });
    }
    else {
            tb_show("","/tools/finance-tools/payment-estimator-pop-up.aspx?title=" + title.replace(/\ /g,'%20') + "&price=" + price + "&modelid=" + modelid + "&dc=" + dhCost + "&width=750&amp;TB_iframe=true&amp;height=570&amp;modal=true","");
    }
}

function CalcVars(ModelGroup,Certified) {

    this.ModelGroup = ModelGroup;
    this.APR = '5';
    this.CertifiedAPR = '12';
    this.FTerm = '60';
    this.LTerm = '36';
    this.DownPayment = '0';
    this.Mileage = "12,000";
    this.TradeInVal = '0';
    this.TradeInOwed = '0';
    this.Certified = Certified;
    
    this.load = function() {
        if ( GetCookie("calculatorVars") ) {
            var arr = GetCookie("calculatorVars").split(";");
            if(this.ModelGroup == arr[0].split("=")[1]) {
                if( arr[1].split("=")[1] != "") this.APR = arr[1].split("=")[1];
                if( arr[2].split("=")[1] != "") this.FTerm = arr[2].split("=")[1];
                if( arr[3].split("=")[1] != "") this.LTerm = arr[3].split("=")[1];
                if( arr[4].split("=")[1] != "") this.DownPayment = arr[4].split("=")[1];
                if( arr[5].split("=")[1] != "") this.Mileage = arr[5].split("=")[1];
                if( arr[6].split("=")[1] != "") this.TradeInVal = arr[6].split("=")[1];
                if( arr[7].split("=")[1] != "") this.TradeInOwed = arr[7].split("=")[1];
                if( arr[8].split("=")[1] != "") this.CertifiedAPR = arr[8].split("=")[1];
                if( this.Certified = true ) { this.APR == this.CertifiedAPR }
            }
        }
    }
    
    this.save = function() {
        var CookieTxt = "";
        CookieTxt += "ModelID=" + this.ModelGroup + ";";
        CookieTxt += "APR=" + this.APR + ";";
        CookieTxt += "FTerm=" + this.FTerm + ";";
        CookieTxt += "LTerm=" + this.LTerm + ";";
        CookieTxt += "DownPayment=" + this.DownPayment + ";";
        CookieTxt += "Mileage=" + this.Mileage + ";";
        CookieTxt += "TradeInVal=" + this.TradeInVal + ";";
        CookieTxt += "TradeInOwed=" + this.TradeInOwed + ";";
        CookieTxt += "CertifiedAPR=" + this.CertifiedAPR;
        SetCookie("calculatorVars", CookieTxt);
    }
}

function priceTagInfoToggle() {
    if ( $("#imgToggle")[0].src.indexOf("-show.gif") != -1 ) {
        $("#imgToggle")[0].src = $("#imgToggle")[0].src.replace("-show.gif","-hide.gif");
        $("#priceTagContent").animate({height:"135px"},500);
        $("#showLink").text("Hide");
    }
    else {
        $("#imgToggle")[0].src = $("#imgToggle")[0].src.replace("-hide.gif","-show.gif");
        $("#priceTagContent").animate({height:"90px"},500);
        $("#showLink").text("Show");
    }
}

//STANDARD FEATURES
function standardFeatures(modelname,year,modelid) {
    modelname = (!modelname || modelname == "") ? sModelName : modelname;
    year = (!year || year == "") ? sModelYear : year;
    modelid = (!modelid || modelid == "") ? sModelID : modelid;
    tb_show("","/tools/standard-features-pop-up.aspx?name=" + modelname.replace(/\ /g,'%20') + "&year=" + year + "&id=" + modelid + "&width=801&amp;TB_iframe=true&amp;height=490&amp;modal=true","")
    
    // Tracking
    var sTempPageName = s.pageName;
    var sTempChannel = s.channel;
    var sTempProp26 = s.prop26;
    var sTempProp27 = s.prop27;
    var sTempProp37 = s.prop37;
    var sTempEvents = s.events;
    s.pageName = 'STANDARD FEATURES';
    s.channel = 'FEATURES';
    s.prop26 = 'STANDARD';
    s.prop27 = 'DEFAULT';
    s.prop37 = 'FEATURES:STANDARD:DEFAULT:STANDARD FEATURES';
    s.events = '';
    CallSDotT(s);
    // Put old variables back for links
    s.pageName = sTempPageName;
    s.channel = sTempChannel;
    s.prop26 = sTempProp26;
    s.prop27 = sTempProp27;
    s.prop37 = sTempProp37;
    s.events = sTempEvents;

}

//DETAIL BUBBLE
//
//These functions handle the detail panel that slides out from behind the shopping tools menu
var canvasMenuSlideSpeed = 400;

//detailHTML is the HTML to be placed inside the detail bubble
function SlideDetailBubble(detailHTML){
    if (!$("#detail-bubble").is(":visible")){
        $("#detail-bubble").html(detailHTML);
        setTimeout(function(){$("#detail-bubble").css({display: "block"}).animate({left: "363px"}, canvasMenuSlideSpeed);}, 25);
    }
}

function ExpandDetailBubble(detailHTML){
    if (!$("#detail-bubble").is(":visible")){
        $("#detail-bubble").css({left: "363px"}).html(detailHTML).show(canvasMenuSlideSpeed);
    }
}

function AdjustDetailBubble(detailHTML, autoAdjustSize){
    if (autoAdjustSize == null){ autoAdjustSize = true; }
    
    if ($("#detail-bubble").is(":visible")){
        $("#pre-detail-change").html(detailHTML);
        setTimeout(function(){
            if (autoAdjustSize){
                $("#detail-bubble").animate({height: ($("#pre-detail-change")[0].offsetHeight - 20) + "px"}, canvasMenuSlideSpeed).html($("#pre-detail-change").html());
            }else{
                 $("#detail-bubble").html($("#pre-detail-change").html());
            }
        }, 25);
    }
}

function ShowDetailBubble(detailHTML, forceShow){
    if (!$("#detail-bubble").is(":visible") || forceShow){
        $("#detail-bubble").html(detailHTML);
        setTimeout(function(){ $("#detail-bubble").css({display: "block", left: "363px"}); }, 25);
    }
}

function HideDetailBubble(){
    if ($("#detail-bubble").is(":visible")){
        $("#detail-bubble").stop(true, true).css({display: "none", left: "0px", height: ""}).html("");
    }
}

//To animate hiding the detail bubble - companion to SlideDetailBubble
function SlideOutDetailBubble(){
    if ($("#detail-bubble").is(":visible")){
        setTimeout(HideDetailBubble, canvasMenuSlideSpeed - 100);
        $("#detail-bubble").animate({left: "0px"}, canvasMenuSlideSpeed);
    }
}

//To animate hiding the detail bubble - companion to ExpandDetailBubble
function ShrinkOutDetailBubble(){
    if ($("#detail-bubble").is(":visible")){
        setTimeout(HideDetailBubble, canvasMenuSlideSpeed + 25);
        $("#detail-bubble").hide(canvasMenuSlideSpeed);
    }
}

//CHECKBOX LIST
//
//This function handles the task of adding functionality to listitems with checkboxes as children
//
//matchStr is the jquery selector to use to find the listitems on the page (ie ".side-nav > li")
//listType is a string used to distinguish what happens when the li is clicked
function SetListItems(matchStr, listType){
    $(matchStr).each(function(){
        $(this).mouseover(function(){
            $(this).addClass('select');
        }).mouseout(function(){
            if (!this.firstChild.checked){
                $(this).removeClass('select');
            }
        }).click(function(){
            if (!$(this).is(".inactiveCbLi")){
                $(this).addClass('select');
                this.firstChild.checked = !this.firstChild.checked;
                if (listType == "modelFilters"){
                    FilterModels(this.firstChild);
                }
                if (listType == "accList"){
                    SwapAccSelection($(this.firstChild).val(), this.firstChild.checked);
                }
            }
        }).children().click(function(){
            this.checked = !this.checked;
        });
    });
}

//The checkbox in a Checkbox List has the id on it - so if you find that you need to select a list item
//in a Checkbox List dynamically, you can do so with this function
//
//checkboxId - the id of the checkbox who's parent list-item you need to set as selected
function SwitchListItemFromCheckbox(checkboxId){
    if ($("#" + checkboxId).length > 0){
        if (!$("#" + checkboxId)[0].checked){
            $("#" + checkboxId).parent().addClass('select');
            $("#" + checkboxId)[0].checked = true;
        }else{
            $("#" + checkboxId).parent().removeClass('select');
            $("#" + checkboxId)[0].checked = false;
        }
    }
}

//In some cases it may be necessary to prevent a checkbox list item from being selectable - this function toggles
//an item's selectability
//
//checkboxId - the id of the checkbox who's parent list-item you need to set as inactive
function SwitchListItemActive(checkboxId){
    if ($("#" + checkboxId).length > 0){
        if ($("#" + checkboxId)[0].disabled){
            $("#" + checkboxId).attr("disabled", "");
            $("#" + checkboxId).parent().removeClass('inactiveCbLi');
        }else{
            $("#" + checkboxId).attr("disabled", "disabled");
            $("#" + checkboxId).parent().addClass('inactiveCbLi');
        }
    }
}

//BASE CAR PHOTO
//
//This function builds the base car photo, as well as the front/rear buttons
//
//exColorId is a string value of the exterior color id, if known - Optional
//inColorId is a string value of the interior color id, if known - Optional
//givenModelId is a string value of model id, if it's not apart of the query string yet (ie on the trims page) - Optional
function ShowCarPhoto(givenModelId, exColorId, inColorId, smallerSize){
    var modelId = "";
    if (givenModelId && givenModelId != ""){
        modelId = givenModelId;
    }else{
        modelId = (sModelID == "null") ? "" : sModelID;
    }
    
    var modelListIndex = (modelId == "") ? (modelList.length - 1) : -1;
    if (modelListIndex == -1){
        for(var i=0;i<modelList.length;++i){
            if (modelList[i][1] == modelId){
                modelListIndex = i;
            }
        }
    }

    if (modelListIndex > -1) {
        var frontPhotoPath = GetBaseCarPhotoPath(modelListIndex, exColorId, inColorId, "FRONT");
        var rearPhotoPath = GetBaseCarPhotoPath(modelListIndex, exColorId, inColorId, "REAR");
        
        var tempFrontImg = new Image();
        var tempRearImg = new Image();
        tempFrontImg.src = frontPhotoPath;
        tempRearImg.src = rearPhotoPath;
        
        setTimeout(function(){
            AddPhotoDivs(frontPhotoPath, rearPhotoPath, smallerSize);
            
            $("#frontViewBtn").unbind();
            $("#rearViewBtn").unbind();
            $("#frontViewBtn").click(function(){ SwitchCarPhoto("FRONT"); });
            $("#rearViewBtn").click(function(){ SwitchCarPhoto("REAR"); });
        }, 100);
    }
}

//switchTo - either "FRONT" or "REAR"
function SwitchCarPhoto(switchTo){
    switchTo = (switchTo && switchTo != "") ? switchTo.toUpperCase() : "FRONT";
    var currentPhotoType = $("#rearPhotosDiv").is(":visible") ? "REAR" : "FRONT";
    var doSwitch = true;
    
    if (currentPhotoType != switchTo){
        if (currentPhotoType == "FRONT"){
            currentPhotoType = "REAR";
            $("#frontViewBtn").attr("src", "/images/tools/build-price/btn-frontview.gif");
            $("#frontViewBtn").css({cursor: "pointer"});
            $("#rearViewBtn").attr("src", "/images/tools/build-price/btn-rearview-select.gif");
            $("#rearViewBtn").css({cursor: "default"});
        }else if (currentPhotoType == "REAR"){
            currentPhotoType = "FRONT";
            $("#frontViewBtn").attr("src", "/images/tools/build-price/btn-frontview-select.gif");
            $("#frontViewBtn").css({cursor: "default"});
            $("#rearViewBtn").attr("src", "/images/tools/build-price/btn-rearview.gif");
            $("#rearViewBtn").css({cursor: "pointer"});
        }
    }else{
        doSwitch = false;
    }
    
    if (doSwitch){
        $("#frontPhotosDiv").animate({opacity: "toggle"}, 600);
        $("#rearPhotosDiv").animate({opacity: "toggle"}, 600);
    }
}

//type is a string: either "FRONT" or "REAR" - defaults to "FRONT"
function GetBaseCarPhotoPath(modelListIndex, exColorId, inColorId, type){
    var path = "";
    type = (type == null || type == "") ? "FRONT" : type.toUpperCase();
    
    if (!exColorId || exColorId == "" || modelList[modelListIndex][6].indexOf(exColorId) == -1){
        for(var i=0;i<exColorList.length;++i){
            if (modelList[modelListIndex][6].indexOf(exColorList[i][6]) > -1){
                exColorId = exColorList[i][6];
                break;
            }
        }
    }
    
    var exInColors = "";
    $.each(exColorList, function(){
        if(this[6] == exColorId){
            exInColors = this[5];
            return false;
        }
    });
    
    var modelStartIndex = exInColors.indexOf(modelList[modelListIndex][1] + "~");
    var modelEndIndex = exInColors.substr(modelStartIndex).indexOf("/");
    
    var modelExInColors = "";
    if (modelEndIndex == -1){
        modelExInColors = exInColors.substr(modelStartIndex);
    }else{
        modelExInColors = exInColors.substr(modelStartIndex, (modelEndIndex - modelStartIndex));
    }
    
    if (exInColors != "" && (!inColorId || inColorId == "" || modelExInColors.indexOf(inColorId) == -1)){
        var indexStartInColors = modelExInColors.indexOf("~")+1;
        var endFirstInColor = modelExInColors.indexOf("|");
        
        if (endFirstInColor == -1){
            inColorId = modelExInColors.substr(indexStartInColors);
        }else{
            inColorId = modelExInColors.substr(indexStartInColors, (endFirstInColor - indexStartInColors));
        }
    }
    
    $.each(baseCarPhotoList, function(){
        if (modelList[modelListIndex][5].indexOf($(this)[0]) > -1){                
            if ($(this)[2].indexOf(exColorId) > -1 && $(this)[2].indexOf(inColorId) > -1){            
                if ($(this)[1].indexOf(type) > -1){
                    path = $(this)[1];
                }
            }
        }
    });
    
    return path;
}

var photoCount = 0;
function AddPhotoDivs(frontPhotoPath, rearPhotoPath, smallerSize){
    if (smallerSize){
        frontPhotoPath = GetCarImageSize(frontPhotoPath, 300, 200);
        rearPhotoPath = GetCarImageSize(rearPhotoPath, 300, 200);
    }
    
    var frontSRC = $.browser.msie ? "/images/trans.gif" : escape(frontPhotoPath);
    var rearSRC = $.browser.msie ? "/images/trans.gif" : escape(rearPhotoPath);
    var imageSizeStyle = smallerSize ? "height: 200px; width: 300px;" : "height: 450px; width: 550px;";
    
    if ($("#threeQuartFrontImg").length == 0){
        var frontPhoto = "<div id=\"threeQuartFrontImg\"><div id=\"front" + photoCount + "\" style=\"position: absolute;\"><img id=\"frontImg\" src=\"" + frontSRC + "\" style=\"" + imageSizeStyle + " filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + escape(frontPhotoPath) + "',sizingMethod='scale');\" /></div></div>";
        var rearPhoto = "<div id=\"threeQuartRearImg\"><div id=\"rear" + photoCount + "\" style=\"position: absolute;\"><img id=\"rearImg\" src=\"" + rearSRC + "\" style=\"" + imageSizeStyle + " filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + escape(rearPhotoPath) + "',sizingMethod='scale');\" /></div></div>";
        var frBtns = "<img id=\"frontViewBtn\" style=\"cursor: default;\" alt=\"FRONT\" title=\"FRONT\" src=\"/images/tools/build-price/btn-frontview-select.gif\" /><img id=\"rearViewBtn\" alt=\"REAR\" title=\"REAR\" src=\"/images/tools/build-price/btn-rearview.gif\" />";
        
        if ($("#frontPhotosDiv").length > 0){ $("#frontPhotosDiv").html(frontPhoto); }
        if ($("#rearPhotosDiv").length > 0){ $("#rearPhotosDiv").html(rearPhoto); }
        if ($("#photoBtnsDiv").length > 0){ $("#photoBtnsDiv").html(frBtns); }
    }else{
        if ($("#frontImg").attr("src") != frontSRC){
            var existPhotoNum = photoCount;
            ++photoCount;
            var newPhotoNum = photoCount;
            
            var frontHTML = $("#threeQuartFrontImg").html();
            $("#threeQuartFrontImg").html(frontHTML + "<div id=\"front" + newPhotoNum + "\" style=\"display: none; position: absolute;\"><img id=\"frontImg\" src=\"" + frontSRC + "\" style=\"" + imageSizeStyle + " filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + escape(frontPhotoPath) + "',sizingMethod='scale');\" /></div>");
            $("#front" + newPhotoNum).fadeIn(600);
            setTimeout(function(){
                $("#front" + existPhotoNum).fadeOut(700, function(){
                    $("#front" + existPhotoNum).remove();
                });
            }, 150);
            
            var rearHTML = $("#threeQuartRearImg").html();
            $("#threeQuartRearImg").html(rearHTML + "<div id=\"rear" + newPhotoNum + "\" style=\"display: none; position: absolute;\"><img id=\"rearImg\" src=\"" + rearSRC + "\" style=\"" + imageSizeStyle + " filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + escape(rearPhotoPath) + "',sizingMethod='scale');\" /></div>");
            $("#rear" + newPhotoNum).fadeIn(600);
            setTimeout(function(){
                $("#rear" + existPhotoNum).fadeOut(700, function(){
                    $("#rear" + existPhotoNum).remove();
                });
            }, 150);
        }
        
        //$("#threeQuartFrontImg > img").attr("src", frontSRC);
        //$("#threeQuartRearImg > img").attr("src", rearSRC);
        //$("#threeQuartFrontImg > img").attr("style", "" + imageSizeStyle + " filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + escape(frontPhotoPath) + "',sizingMethod='scale');");
        //$("#threeQuartRearImg > img").attr("style", "" + imageSizeStyle + " filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + escape(rearPhotoPath) + "',sizingMethod='scale');");
    }
}

//FORWARD/BACKWARD BUTTONS
//
//Since the shopping controls are shared between Build and Price, Request a Quote, etc.
//we needed a way to get their back/next buttons to go to different places.  The solution was to put javascript variables
//on each page that the controls would assume were there.  Those variables are called:
//ForwardPage
//BackwardPage
//QueryStringsToAdd
//QueryStringsToRemove
//So a call to this function from one of the shopping controls might be:  GoForwardBack(ForwardPage, QueryStringsToAdd) or GoForwardBack(BackwardPage, "", QueryStringsToRemove)
//
//newPage is the name of the page you're going to (ie ForwardPage or BackwardPage) - example: "models.aspx"
//queryStringsToAdd is a pipe separated string of the name/value pairs (separated by a forward-slash just like that) of query strings to add, if any - example: "modelId/1234R|modelYear/1900"
//queryStringsToRemove is a pipe separated string of the names of query strings to remove, if any - example: "modelId|modelYear"
function GoForwardBack(newPage, queryStringsToAdd, queryStringsToRemove, source){
    var tempQueryStr = window.location.search;
    var winLoc = window.location.toString().replace(tempQueryStr, "");
    
    if (queryStringsToAdd && queryStringsToAdd != "" && tempQueryStr != ""){
        //First, check for their existence in the current url
        var pairs = queryStringsToAdd.split("|");
        $.each(pairs, function(){
            var pair = this.split("/");
            if (tempQueryStr.indexOf(pair[0]) > -1){
                queryStringsToRemove += "|" + pair[0];
            }
        });
    }
    if (queryStringsToRemove && tempQueryStr != ""){
        //Next, remove all query strings to be removed
        var names = queryStringsToRemove.split("|");
        $.each(names, function(){
            if (tempQueryStr.indexOf(this) > -1){
                var removeVal = $.getQueryString({id:this});
                var removeStr = this + "=" + removeVal;
                tempQueryStr = tempQueryStr.replace(removeStr, "").replace(removeStr.replace(/ /g, "%20"), "");
                tempQueryStr = tempQueryStr.replace("&&", "&").replace("?&", "?");
            }
        });
    }
    if (queryStringsToAdd && queryStringsToAdd != ""){
        //Last, add all query strings to be added
        var pairs = queryStringsToAdd.split("|");
        $.each(pairs, function(){
            var pair = this.split("/");
            if (pair.length == 2){
                if (tempQueryStr.length == 0){
                    tempQueryStr += "?" + pair[0] + "=" + pair[1];
                }else{
                    tempQueryStr += "&" + pair[0] + "=" + pair[1];
                }
            }
        });
    }
    
    tempQueryStr = tempQueryStr.length > 1 ? tempQueryStr.replace("&&", "&").replace("?&", "?") : "";
    tempQueryStr = tempQueryStr.lastIndexOf("&") == tempQueryStr.length-1 ? tempQueryStr.substr(0,tempQueryStr.length-1) : tempQueryStr;
    
    TrackNavigationChange(source);
    
    documentDotLocation(newPage + tempQueryStr);
}

function TrackNavigationChange(source) {

    // Tracking based on source
    s.linkTrackVars = 'prop26,prop27,prop37,eVar26,eVar27';
    switch (source) {
        case 'raq_1_vehandzip':
            s.prop26 = 'COLORS';
            s.prop27 = 'BACKWARD';
            s.prop37 = 'RAQ:COLORS:DEFAULT:RAQ - SELECT COLORS';
            CallSDotTL(s , true , 'RAQ:COLORS:BACKWARD:VEHICLE & ZIP CODE TOP NAV LINK' , 'o');
            break;
        case 'raq_2_vehandzip':
            s.prop26 = 'DEALER';
            s.prop27 = 'BACKWARD';
            s.prop37 = 'RAQ:DEALER:DEFAULT:RAQ - SELECT A DEALER';
            CallSDotTL(s , true , 'RAQ:DEALER:BACKWARD:VEHICLE & ZIP CODE TOP NAV LINK' , 'o');
            break;
        case 'raq_3_vehandzip':
            s.prop26 = 'CONTACT';
            s.prop27 = 'BACKWARD';
            s.prop37 = 'RAQ:CONTACT:DEFAULT:RAQ - ENTER CONTACT INFORMATION';
            CallSDotTL(s , true , 'RAQ:CONTACT:BACKWARD:VEHICLE & ZIP CODE TOP NAV LINK' , 'o');
            break;
        case 'raq_2_colors':
            s.prop26 = 'DEALER';
            s.prop27 = 'BACKWARD';
            s.prop37 = 'RAQ:DEALER:DEFAULT:RAQ - SELECT A DEALER';
            CallSDotTL(s , true , 'RAQ:DEALER:BACKWARD:COLORS TOP NAV LINK' , 'o');
            break;
        case 'raq_3_colors':
            s.prop26 = 'CONTACT';
            s.prop27 = 'BACKWARD';
            s.prop37 = 'RAQ:CONTACT:DEFAULT:RAQ - ENTER CONTACT INFORMATION';
            CallSDotTL(s , true , 'RAQ:CONTACT:BACKWARD:COLORS TOP NAV LINK' , 'o');
            break;
        case 'raq_1_dealer':
            s.prop26 = 'COLORS';
            s.prop27 = 'FORWARD';
            s.prop37 = 'RAQ:COLORS:DEFAULT:RAQ - SELECT COLORS';
            CallSDotTL(s , true , 'RAQ:COLORS:FORWARD:DEALER TOP NAV LINK' , 'o');
            break;
        case 'raq_3_dealer':
            s.prop26 = 'CONTACT';
            s.prop27 = 'BACKWARD';
            s.prop37 = 'RAQ:CONTACT:DEFAULT:RAQ - ENTER CONTACT INFORMATION';
            CallSDotTL(s , true , 'RAQ:CONTACT:BACKWARD:DEALER TOP NAV LINK' , 'o');
            break;
        case 'raq_colors_back':
            s.prop26 = 'COLORS';
            s.prop27 = 'BACKWARD';
            s.prop37 = 'RAQ:COLORS:DEFAULT:RAQ - SELECT COLORS';
            CallSDotTL(s , true , 'RAQ:COLORS:BACKWARD:BACK LINK' , 'o');
            break;
        case 'raq_colors_nextbtn':
            s.prop26 = 'COLORS';
            s.prop27 = 'FORWARD';
            s.prop37 = 'RAQ:COLORS:DEFAULT:RAQ - SELECT COLORS';
            CallSDotTL(s , true , 'RAQ:COLORS:FORWARD:NEXT:SELECT A DEALER LINK' , 'o');
            break;
        case 'bnp_colors_back':
            s.prop26 = 'COLORS';
            s.prop27 = 'BACKWARD';
            s.prop37 = 'BUILD & PRICE:COLORS:DEFAULT:B&P - SELECT COLORS';
            CallSDotTL(s , true , 'BUILD & PRICE:COLORS:BACKWARD:BACK LINK' , 'o');
            break;
        case 'bnp_colors_nextbtn':
            s.prop26 = 'COLORS';
            s.prop27 = 'FORWARD';
            s.prop37 = 'BUILD & PRICE:COLORS:DEFAULT:B&P - SELECT COLORS';
            CallSDotTL(s , true , 'BUILD & PRICE:COLORS:FORWARD:NEXT:ACCESSORIES LINK' , 'o');
            break;
        case 'bnp_accessories_back':
            s.prop26 = 'ACCESSORIES';
            s.prop27 = 'BACKWARD';
            s.prop37 = 'BUILD & PRICE:ACCESSORIES:DEFAULT:B&P - SELECT ACCESSORIES';
            CallSDotTL(s , true , 'BUILD & PRICE:ACCESSORIES:BACKWARD:BACK LINK' , 'o');
            break;
        case 'bnp_accessories_nextbtn':
            s.prop26 = 'ACCESSORIES';
            s.prop27 = 'FORWARD';
            s.prop37 = 'BUILD & PRICE:ACCESSORIES:DEFAULT:B&P - SELECT ACCESSORIES';
            CallSDotTL(s , true , 'BUILD & PRICE:COLORS:FORWARD:NEXT:SUMMARY LINK' , 'o');
            break;
        case 'bnp_summary_startover':
            s.prop26 = 'SUMMARY';
            s.prop27 = 'RESET';
            s.prop37 = 'BUILD & PRICE:SUMMARY:DEFAULT:B&P - SUMMARY';
            CallSDotTL(s , true , 'BUILD & PRICE:SUMMARY:RESET:START OVER LINK' , 'o');
            break;
        case 'bnp_confirm_startover':
            s.prop26 = 'QUOTE';
            s.prop27 = 'RESET';
            s.prop37 = 'BUILD & PRICE:QUOTE:DEFAULT:B&P - QUOTE REQUEST CONFIRMATION';
            CallSDotTL(s , true , 'BUILD & PRICE:QUOTE:RESET:START OVER LINK' , 'o');
            break;
        case 'bnp_2_hondatab':
            s.prop26 = 'MODEL';
            s.prop27 = 'BACKWARD';
            s.prop37 = 'BUILD & PRICE:MODEL:DEFAULT:B&P - SELECT A MODEL';
            CallSDotTL(s , true , 'BUILD & PRICE:MODEL:BACKWARD:HONDA NAV LINK' , 'o');
            break;
        case 'bnp_2_colortab':
            s.prop26 = 'MODEL';
            s.prop27 = 'FORWARD';
            s.prop37 = 'BUILD & PRICE:MODEL:DEFAULT:B&P - SELECT A MODEL';
            CallSDotTL(s , true , 'BUILD & PRICE:MODEL:FORWARD:COLORS NAV LINK' , 'o');
            break;
        case 'bnp_3_hondatab':
            s.prop26 = 'COLORS';
            s.prop27 = 'BACKWARD';
            s.prop37 = 'BUILD & PRICE:COLORS:DEFAULT:B&P - SELECT COLORS';
            CallSDotTL(s , true , 'BUILD & PRICE:COLORS:BACKWARD:HONDA NAV LINK' , 'o');
            break;
        case 'bnp_3_modeltab':
            s.prop26 = 'COLORS';
            s.prop27 = 'BACKWARD';
            s.prop37 = 'BUILD & PRICE:COLORS:DEFAULT:B&P - SELECT COLORS';
            CallSDotTL(s , true , 'BUILD & PRICE:COLORS:BACKWARD:MODEL NAV LINK' , 'o');
            break;
        case 'bnp_3_acctab':
            s.prop26 = 'COLORS';
            s.prop27 = 'FORWARD';
            s.prop37 = 'BUILD & PRICE:COLORS:DEFAULT:B&P - SELECT COLORS';
            CallSDotTL(s , true , 'BUILD & PRICE:COLORS:FORWARD:ACCESSORIES NAV LINK' , 'o');
            break;
        case 'bnp_3_summarytab':
            s.prop26 = 'COLORS';
            s.prop27 = 'FORWARD';
            s.prop37 = 'BUILD & PRICE:COLORS:DEFAULT:B&P - SELECT COLORS';
            CallSDotTL(s , true , 'BUILD & PRICE:COLORS:FORWARD:SUMMARY NAV LINK' , 'o');
            break;
        case 'bnp_4_hondatab':
            s.prop26 = 'ACCESSORIES';
            s.prop27 = 'BACKWARD';
            s.prop37 = 'BUILD & PRICE:ACCESSORIES:DEFAULT:B&P - SELECT ACCESSORIES';
            CallSDotTL(s , true , 'BUILD & PRICE:ACCESSORIES:BACKWARD:HONDA NAV LINK' , 'o');
            break;
        case 'bnp_4_modeltab':
            s.prop26 = 'ACCESSORIES';
            s.prop27 = 'BACKWARD';
            s.prop37 = 'BUILD & PRICE:ACCESSORIES:DEFAULT:B&P - SELECT ACCESSORIES';
            CallSDotTL(s , true , 'BUILD & PRICE:ACCESSORIES:BACKWARD:MODEL NAV LINK' , 'o');
            break;
        case 'bnp_4_colortab':
            s.prop26 = 'MODEL';
            s.prop27 = 'BACKWARD';
            s.prop37 = 'BUILD & PRICE:MODEL:DEFAULT:B&P - SELECT ACCESSORIES';
            CallSDotTL(s , true , 'BUILD & PRICE:MODEL:BACKWARD:COLORS NAV LINK' , 'o');
            break;
        case 'bnp_4_summarytab':
            s.prop26 = 'ACCESSORIES';
            s.prop27 = 'FORWARD';
            s.prop37 = 'BUILD & PRICE:ACCESSORIES:DEFAULT:B&P - SELECT ACCESSORIES';
            CallSDotTL(s , true , 'BUILD & PRICE:ACCESSORIES:FORWARD:SUMMARY NAV LINK' , 'o');
            break;
        case 'bnp_5_hondatab':
            s.prop26 = 'SUMMARY';
            s.prop27 = 'BACKWARD';
            s.prop37 = 'BUILD & PRICE:SUMMARY:DEFAULT:B&P - SUMMARY';
            CallSDotTL(s , true , 'BUILD & PRICE:SUMMARY:BACKWARD:HONDA NAV LINK' , 'o');
            break;
        case 'bnp_5_modeltab':
            s.prop26 = 'SUMMARY';
            s.prop27 = 'BACKWARD';
            s.prop37 = 'BUILD & PRICE:SUMMARY:DEFAULT:B&P - SUMMARY';
            CallSDotTL(s , true , 'BUILD & PRICE:SUMMARY:BACKWARD:MODEL NAV LINK' , 'o');
            break;
        case 'bnp_5_colortab':
            s.prop26 = 'SUMMARY';
            s.prop27 = 'BACKWARD';
            s.prop37 = 'BUILD & PRICE:SUMMARY:DEFAULT:B&P - SUMMARY';
            CallSDotTL(s , true , 'BUILD & PRICE:SUMMARY:BACKWARD:COLORS NAV LINK' , 'o');
            break;
        case 'bnp_5_acctab':
            s.prop26 = 'SUMMARY';
            s.prop27 = 'BACKWARD';
            s.prop37 = 'BUILD & PRICE:SUMMARY:DEFAULT:B&P - SUMMARY';
            CallSDotTL(s , true , 'BUILD & PRICE:SUMMARY:BACKWARD:ACCESSORIES NAV LINK' , 'o');
            break;
        case 'raq_trims_accordionback':
            s.prop26 = 'VEHICLE';
            s.prop27 = 'BACKWARD';
            s.prop37 = 'RAQ:VEHICLE:HELP:RAQ - HELP ME SELECT A TRIM';
            CallSDotTL(s , true , 'RAQ:VEHICLE:BACKWARD:BACK LINK' , 'o');
            break;
        case 'bnp_trims_accordionback':
            s.prop26 = 'MODEL';
            s.prop27 = 'BACKWARD';
            s.prop37 = 'BUILD & PRICE:MODEL:DEFAULT:B&P - SELECT A MODEL';
            CallSDotTL(s , true , 'BUILD & PRICE:MODEL:BACKWARD:BACK LINK' , 'o');
            break;
        case 'bnp_trims_accordioncolors':
            s.prop26 = 'MODEL';
            s.prop27 = 'FORWARD';
            s.prop37 = 'BUILD & PRICE:FORWARD:DEFAULT:B&P - SELECT A MODEL';
            CallSDotTL(s , true , 'BUILD & PRICE:MODEL:FORWARD:NEXT:COLORS LINK' , 'o');
            break;
        case 'raq_trims_accordioncolors':
            s.prop26 = 'VEHICLE';
            s.prop27 = 'FORWARD';
            s.prop37 = 'RAQ:VEHICLE:HELP:RAQ - HELP ME SELECT A TRIM';
            CallSDotTL(s , true , 'RAQ:VEHICLE:FORWARD:NEXT:SELECT COLORS LINK' , 'o');
            break;

            

    }

}


//GENERAL
function calcMsrp(msrp, dhCost){
    var cleanMsrp = parseFloat(msrp.replace("$", "").replace(",", ""));
    var cleanDh = parseFloat(dhCost.replace("$", "").replace(",", ""));
    var sumStr = (cleanMsrp + cleanDh).toFixed(2).toString();
    var indexOfComma = sumStr.length - 6; //instead of sub-stringing forward 2 I'm working my way back from the hundredths place, in the off-chance the MSRP's over $100,000.00
    return "$" + sumStr.substr(0, indexOfComma) + "," + sumStr.substr(indexOfComma);
}

function removeDecimal(price){
    //return price.toString().replace(".00", "");
    var numStr = Math.round(parseFloat(price.replace("$", "").replace(",", ""))).toString();
    var indexOfComma = numStr.length - 3;
    if (numStr.length > 3){
        return "$" + numStr.substr(0, indexOfComma) + "," + numStr.substr(indexOfComma);
    }else{
        return "$" + numStr;
    }
}

// Process tracking information from querystring and page variables
function ProcessTrackingInformation(s) {

    var sModelName = $.getQueryString({id:"ModelName"});
    var sModelYear = $.getQueryString({id:"ModelYear"});
    var sModelID = $.getQueryString({id:"ModelID"});
    var sSelected = $.getQueryString({id:"Selected"});
    var sExtColor = $.getQueryString({id:"EColor"});
    var sIntColor = $.getQueryString({id:"IColor"});

    if (sModelName != 'null') {

        // Model    
        if (typeof(trimList) != 'undefined') {
            s.prop1 = trimList[0][3].toUpperCase();
        }

        // Year
        var sModelYear = sModelYear;
        if (sModelYear != 'null') {
            s.prop2 = sModelYear;
        }

        // Product
        if (s.prop1) {
            s.products = GetModelProductType(s.prop1) + ':' + s.prop1;
        }

    }

    if (sModelID != 'null') {

        // Transmission and trim name
        if (typeof(modelList) != 'undefined') {
            var stTransmissionName = modelList[0][4].toUpperCase();
            var stWheelDrive = '';
            
            stTransmissionName = ExtractTransmissionInfo(stTransmissionName , stWheelDrive);
            stWheelDrive = stTransmissionName.split('|')[1];
            stTransmissionName = stTransmissionName.split('|')[0];            

            s.prop5 = stWheelDrive + trimList[0][0].toUpperCase();
            s.prop33 = stTransmissionName;
        }
        
    }
            
    if ( (sExtColor != 'null') && (sIntColor != 'null') ) {

        if ( (typeof(exColorList) != 'undefined') && (typeof(inColorList) != 'undefined') ) {
            var stExteriorColorName = '';
            var stInteriorColorName = '';

            for (var iCount = 0; iCount< exColorList.length; iCount++) {
                if (exColorList[iCount][6] == $.getQueryString({id:"EColor"})) {
                    stExteriorColorName = exColorList[iCount][0].toUpperCase();
                }
            }
            for (var iCount = 0; iCount< inColorList.length; iCount++) {
                if (inColorList[iCount][1] == $.getQueryString({id:"IColor"})) {
                    stInteriorColorName = inColorList[iCount][0].toUpperCase();
                }
            }

            s.prop3 = stExteriorColorName;
            s.prop4 = stInteriorColorName;
        }
    }
            
    if (sSelected != 'null') {
        sSelected = sSelected.replace(/,/g , ':');
        if (sSelected != 'null') {
            s.prop7 = sSelected;
            s.prop6 = sSelected.split(':').length;
        }
    }

    return s;

}

// This function is being broken out so that it can be used by other functions.
// It returns a pipe delimited list of values since it has to return 2 pieces of information.
function ExtractTransmissionInfo(stTransmissionName , stWheelDrive) {

    if (stTransmissionName.indexOf('2WD') >= 0) {
        stWheelDrive = '2WD ';
        stTransmissionName = stTransmissionName.replace(/2WD/ , '');
    }
    if (stTransmissionName.indexOf('4WD') >= 0) {
        stWheelDrive = '4WD ';
        stTransmissionName = stTransmissionName.replace(/4WD/ , '');
    }
    
    return stTransmissionName + "|" + stWheelDrive;

}

// This is a generic function used to track click events through the build and price tool
function TrackBNPClick(s , sLinkName , prop26 , prop27 , sAdditionalLinkTrackVars , sLinkType) {

    if (sAdditionalLinkTrackVars != '') {
        sAdditionalLinkTrackVars = ',' + sAdditionalLinkTrackVars;
    }
    
    if (!sLinkType) {
        sLinkType = 'o'
    }

    s.linkTrackVars = 'prop26,prop27,prop37,eVar26,eVar27' + sAdditionalLinkTrackVars;
    s.prop26 = prop26;
    s.prop27 = prop27;
    CallSDotTL(s , true , sLinkName , sLinkType);

}

function ShowCurrentOffer(modelName, modelYear, modelId, trimName, offerID){
    modelId = (modelId == null) ? "" : modelId;
    trimName = (trimName == null) ? "" : trimName;
    if ( typeof(tb_show) === 'function') {
        tb_show("" , "/tools/current-offers-pop-up.aspx?modelName=" + modelName + "&modelYear=" + modelYear + "&modelId=" + modelId + "&trimName=" + trimName + "&offerID=" + offerID + "&width=740&height=550&modal=true&TB_iframe=true", "");
    } else {
        window.open("/tools/current-offers-pop-up.aspx?modelName=" + modelName + "&modelYear=" + modelYear + "&modelId=" + modelId + "&trimName=" + trimName + "&offerID=" + offerID,"Current_Offers","menubar=no,width=740,height=550,toolbar=no");
    }
}



function FixPNG(){var sAppVersion=navigator.appVersion;if(sAppVersion.indexOf('MSIE')>0){var sVersion=parseFloat(sAppVersion.split('MSIE')[1]);if(sVersion>=7){return;}}else{return;}
var aItems=document.getElementsByTagName('*');for(var iCount=0;iCount<aItems.length;iCount++){var oImg=aItems[iCount];if((oImg.src)&&(oImg.src.toLowerCase().indexOf('.png')>0)){var prevStyle='';var strNewHTML='';var imgID=(oImg.id)?'id="'+oImg.id+'" ':'';var imgClass=(oImg.className)?'class="'+oImg.className+'" ':'';var imgTitle=(oImg.title)?'title="'+oImg.title+'" ':'';var imgAlt=(oImg.alt)?'alt="'+oImg.alt+'" ':'';var imgAlign=(oImg.align)?'float:'+oImg.align+';':'';var imgHand=(oImg.href)?'cursor:hand;':'';var imgStyle='display:inline-block;'+oImg.style.cssText;if(oImg.style.border){prevStyle+='border:'+oImg.style.border+';';oImg.style.border='';}
if(oImg.style.padding){prevStyle+='padding:'+oImg.style.padding+';';oImg.style.padding='';}
if(oImg.style.margin){prevStyle+='margin:'+oImg.style.margin+';';oImg.style.margin='';}
var imgStyle=(oImg.style.cssText);var strNewHTML='<span '+imgID+imgClass+imgTitle+imgAlt;strNewHTML+='style="position:relative;white-space:pre-line;display:inline-block;background:transparent;'+imgAlign+imgHand;strNewHTML+='width:'+oImg.width+'px;'+'height:'+oImg.height+'px;';strNewHTML+='filter:progid:DXImageTransform.Microsoft.AlphaImageLoader'+'(src=\''+oImg.src+'\', sizingMethod=\'scale\');';strNewHTML+=imgStyle+'"></span>';if(prevStyle!=''){strNewHTML='<span style="position:relative;display:inline-block;'+prevStyle+imgHand+'width:'+oImg.width+'px;'+'height:'+oImg.height+'px;'+'">'+strNewHTML+'</span>';}
oImg.outerHTML=strNewHTML;}}
try{var CSSRules;for(var i=0;i<document.styleSheets.length;i++){(document.styleSheets[0].cssRules)?CSSRules='cssRules':CSSRules='rules';for(var j=0;j<document.styleSheets[i][CSSRules].length;j++){if((document.styleSheets[i][CSSRules][j].style['backgroundImage'])&&(document.styleSheets[i][CSSRules][j].style['backgroundImage']!='')&&(document.styleSheets[i][CSSRules][j].style['backgroundImage']!='none')&&(document.styleSheets[i][CSSRules][j].style['backgroundImage'].toLowerCase().indexOf('.png')>0)&&(!document.styleSheets[i][CSSRules][j].style['progid'])){var sOriginalBG=document.styleSheets[i][CSSRules][j].style['backgroundImage'];sOriginalBG=sOriginalBG.replace('url(','');sOriginalBG=sOriginalBG.replace(')','');}}}}catch(err){}
var aItems=document.getElementsByTagName('*');for(var iCount=0;iCount<aItems.length;iCount++){var oItem=aItems[iCount];if(oItem.style.backgroundImage){if(oItem.style.backgroundImage.toLowerCase().indexOf('.png')>0){var sOriginalBG=oItem.style.backgroundImage;sOriginalBG=sOriginalBG.replace('url(','');sOriginalBG=sOriginalBG.replace(')','');document.getElementById(oItem.id).style.backgroundImage='none';document.getElementById(oItem.id).runtimeStyle.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+sOriginalBG+"',sizingMethod='scale')";}}}}

var mboxCopyright = "&copy; 2003-2009. Omniture, Inc. All rights reserved.";mboxUrlBuilder = function(a, b) { this.a = a; this.b = b; this.c = new Array(); this.d = function(e) { return e; }; this.f = null;};mboxUrlBuilder.prototype.addParameter = function(g, h) { var i = new RegExp('(\'|")'); if (i.exec(g)) { throw "Parameter '" + g + "' contains invalid characters"; } for (var j = 0; j < this.c.length; j++) { var k = this.c[j]; if (k.name == g) { k.value = h; return this; } } var l = new Object(); l.name = g; l.value = h; this.c[this.c.length] = l; return this;};mboxUrlBuilder.prototype.addParameters = function(c) { if (!c) { return this; } for (var j = 0; j < c.length; j++) { var m = c[j].indexOf('='); if (m == -1 || m == 0) { continue; } this.addParameter(c[j].substring(0, m), c[j].substring(m + 1, c[j].length)); } return this;};mboxUrlBuilder.prototype.setServerType = function(n) { this.o = n;};mboxUrlBuilder.prototype.setBasePath = function(f) { this.f = f;};mboxUrlBuilder.prototype.setUrlProcessAction = function(p) { this.d = p;};mboxUrlBuilder.prototype.buildUrl = function() { var q = this.f ? this.f : '/m2/' + this.b + '/mbox/' + this.o; var r = document.location.protocol == 'file:' ? 'http:' : document.location.protocol; var e = r + "//" + this.a + q; var s = e.indexOf('?') != -1 ? '&' : '?'; for (var j = 0; j < this.c.length; j++) { var k = this.c[j]; e += s + encodeURIComponent(k.name) + '=' + encodeURIComponent(k.value); s = '&'; } return this.t(this.d(e));};mboxUrlBuilder.prototype.getParameters = function() { return this.c;};mboxUrlBuilder.prototype.setParameters = function(c) { this.c = c;};mboxUrlBuilder.prototype.clone = function() { var u = new mboxUrlBuilder(this.a, this.b); u.setServerType(this.o); u.setBasePath(this.f); u.setUrlProcessAction(this.d); for (var j = 0; j < this.c.length; j++) { u.addParameter(this.c[j].name, this.c[j].value); } return u;};mboxUrlBuilder.prototype.t = function(v) { return v.replace(/\"/g, '&quot;').replace(/>/g, '&gt;');};mboxStandardFetcher = function() { };mboxStandardFetcher.prototype.getType = function() { return 'standard';};mboxStandardFetcher.prototype.fetch = function(w) { w.setServerType(this.getType()); document.write('<' + 'scr' + 'ipt src="' + w.buildUrl() + '" language="JavaScript"><' + '\/scr' + 'ipt>');};mboxStandardFetcher.prototype.cancel = function() { };mboxAjaxFetcher = function() { };mboxAjaxFetcher.prototype.getType = function() { return 'ajax';};mboxAjaxFetcher.prototype.fetch = function(w) { w.setServerType(this.getType()); var e = w.buildUrl(); this.x = document.createElement('script'); this.x.src = e; document.body.appendChild(this.x);};mboxAjaxFetcher.prototype.cancel = function() { };mboxMap = function() { this.y = new Object(); this.z = new Array();};mboxMap.prototype.put = function(A, h) { if (!this.y[A]) { this.z[this.z.length] = A; } this.y[A] = h;};mboxMap.prototype.get = function(A) { return this.y[A];};mboxMap.prototype.remove = function(A) { this.y[A] = undefined;};mboxMap.prototype.each = function(p) { for (var j = 0; j < this.z.length; j++ ) { var A = this.z[j]; var h = this.y[A]; if (h) { p(A, h); } }};mboxFactory = function(B, b, C) { this.D = false; this.B = B; this.C = C; this.E = new mboxList(); mboxFactories.put(C, this); this.F = typeof document.createElement('div').replaceChild != 'undefined' && (function() { return true; })() && typeof document.getElementById != 'undefined' && typeof (window.attachEvent || document.addEventListener || window.addEventListener) != 'undefined' && typeof encodeURIComponent != 'undefined'; this.G = this.F && mboxGetPageParameter('mboxDisable') == null; var H = C == 'default'; this.I = new mboxCookieManager( 'mbox' + (H ? '' : ('-' + C)), (function() { return mboxCookiePageDomain(); })()); this.G = this.G && this.I.isEnabled() && (this.I.getCookie('disable') == null); if (this.isAdmin()) { this.enable(); } this.J = mboxGenerateId(); this.K = new mboxSession(this.J, 'mboxSession', 'session', 31 * 60, this.I); this.L = new mboxPC('PC', 1209600, this.I); this.w = new mboxUrlBuilder(B, b); this.M(this.w, H); this.N = new Date().getTime(); this.O = this.N; var P = this; this.addOnLoad(function() { P.O = new Date().getTime(); }); if (this.F) { this.addOnLoad(function() { P.D = true; P.getMboxes().each(function(Q) { Q.setFetcher(new mboxAjaxFetcher()); Q.finalize(); }); }); this.limitTraffic(100, 10368000); if (this.G) { this.R(); this.S = new mboxSignaler(function(T, c) { return P.create(T, c); }, this.I); } }};mboxFactory.prototype.isEnabled = function() { return this.G;};mboxFactory.prototype.getDisableReason = function() { return this.I.getCookie('disable');};mboxFactory.prototype.isSupported = function() { return this.F;};mboxFactory.prototype.disable = function(U, V) { if (typeof U == 'undefined') { U = 60 * 60; } if (typeof V == 'undefined') { V = 'unspecified'; } if (!this.isAdmin()) { this.G = false; this.I.setCookie('disable', V, U); }};mboxFactory.prototype.enable = function() { this.G = true; this.I.deleteCookie('disable');};mboxFactory.prototype.isAdmin = function() { return document.location.href.indexOf('mboxEnv') != -1;};mboxFactory.prototype.limitTraffic = function(W, U) {};mboxFactory.prototype.addOnLoad = function(p) { if (window.addEventListener) { window.addEventListener('load', p, false); } else if (document.addEventListener) { document.addEventListener('load', p, false); } else if (document.attachEvent) { window.attachEvent('onload', p); }};mboxFactory.prototype.getEllapsedTime = function() { return this.O - this.N;};mboxFactory.prototype.getEllapsedTimeUntil = function(X) { return X - this.N;};mboxFactory.prototype.getMboxes = function() { return this.E;};mboxFactory.prototype.get = function(T, Y) { return this.E.get(T).getById(Y || 0);};mboxFactory.prototype.update = function(T, c) { if (!this.isEnabled()) { return; } if (this.E.get(T).length() == 0) { throw "Mbox " + T + " is not defined"; } this.E.get(T).each(function(Q) { Q.getUrlBuilder() .addParameter('mboxPage', mboxGenerateId()); Q.load(c); });};mboxFactory.prototype.create = function( T, c, Z) { if (!this.isSupported()) { return null; } var e = this.w.clone(); e.addParameter('mboxCount', this.E.length() + 1); e.addParameters(c); var Y = this.E.get(T).length(); var _ = this.C + '-' + T + '-' + Y; var ab; if (Z) { ab = new mboxLocatorNode(Z); } else { if (this.D) { throw 'The page has already been loaded, can\'t write marker'; } ab = new mboxLocatorDefault(_); } try { var P = this; var bb = 'mboxImported-' + _; var Q = new mbox(T, Y, e, ab, bb); if (this.G) { Q.setFetcher(this.D ? new mboxAjaxFetcher() : new mboxStandardFetcher()); } Q.setOnError(function(cb, n) { Q.setMessage(cb); Q.activate(); if (!Q.isActivated()) { P.disable(60 * 60, cb); window.location.reload(false); } }); this.E.add(Q); } catch (db) { this.disable(); throw 'Failed creating mbox "' + T + '", the error was: ' + db; } var eb = new Date(); e.addParameter('mboxTime', eb.getTime() - (eb.getTimezoneOffset() * 60000)); return Q;};mboxFactory.prototype.getCookieManager = function() { return this.I;};mboxFactory.prototype.getPageId = function() { return this.J;};mboxFactory.prototype.getPCId = function() { return this.L;};mboxFactory.prototype.getSessionId = function() { return this.K;};mboxFactory.prototype.getSignaler = function() { return this.S;};mboxFactory.prototype.getUrlBuilder = function() { return this.w;};mboxFactory.prototype.M = function(e, H) { e.addParameter('mboxHost', document.location.hostname) .addParameter('mboxSession', this.K.getId()); if (!H) { e.addParameter('mboxFactoryId', this.C); } if (this.L.getId() != null) { e.addParameter('mboxPC', this.L.getId()); } e.addParameter('mboxPage', this.J); e.setUrlProcessAction(function(e) { e += '&mboxURL=' + encodeURIComponent(document.location); var fb = encodeURIComponent(document.referrer); if (e.length + fb.length < 2000) { e += '&mboxReferrer=' + fb; } e += '&mboxVersion=' + mboxVersion; return e; });};mboxFactory.prototype.gb = function() { return "";};mboxFactory.prototype.R = function() { document.write('<style>.' + 'mboxDefault' + ' { visibility:hidden; }</style>');};mboxFactory.prototype.isDomLoaded = function() { return this.D;};mboxSignaler = function(hb, I) { this.I = I; var ib = I.getCookieNames('signal-'); for (var j = 0; j < ib.length; j++) { var jb = ib[j]; var kb = I.getCookie(jb).split('&'); var Q = hb(kb[0], kb); Q.load(); I.deleteCookie(jb); }};mboxSignaler.prototype.signal = function(lb, T ) { this.I.setCookie('signal-' + lb, mboxShiftArray(arguments).join('&'), 45 * 60);};mboxList = function() { this.E = new Array();};mboxList.prototype.add = function(Q) { if (Q != null) { this.E[this.E.length] = Q; }};mboxList.prototype.get = function(T) { var mb = new mboxList(); for (var j = 0; j < this.E.length; j++) { var Q = this.E[j]; if (Q.getName() == T) { mb.add(Q); } } return mb;};mboxList.prototype.getById = function(nb) { return this.E[nb];};mboxList.prototype.length = function() { return this.E.length;};mboxList.prototype.each = function(p) { if (typeof p != 'function') { throw 'Action must be a function, was: ' + typeof(p); } for (var j = 0; j < this.E.length; j++) { p(this.E[j]); }};mboxLocatorDefault = function(g) { this.g = 'mboxMarker-' + g; document.write('<div id="' + this.g + '" style="visibility:hidden;display:none">&nbsp;</div>');};mboxLocatorDefault.prototype.locate = function() { var ob = document.getElementById(this.g); while (ob != null) { if (ob.nodeType == 1) { if (ob.className == 'mboxDefault') { return ob; } } ob = ob.previousSibling; } return null;};mboxLocatorDefault.prototype.force = function() { var pb = document.createElement('div'); pb.className = 'mboxDefault'; var qb = document.getElementById(this.g); qb.parentNode.insertBefore(pb, qb); return pb;};mboxLocatorNode = function(rb) { this.ob = rb;};mboxLocatorNode.prototype.locate = function() { return typeof this.ob == 'string' ? document.getElementById(this.ob) : this.ob;};mboxLocatorNode.prototype.force = function() { return null;};mboxCreate = function(T ) { var Q = mboxFactoryDefault.create( T, mboxShiftArray(arguments)); if (Q) { Q.load(); } return Q;};mboxDefine = function(Z, T ) { var Q = mboxFactoryDefault.create(T, mboxShiftArray(mboxShiftArray(arguments)), Z); return Q;};mboxUpdate = function(T ) { mboxFactoryDefault.update(T, mboxShiftArray(arguments));};mbox = function(g, sb, w, tb, bb) { this.ub = null; this.vb = 0; this.ab = tb; this.bb = bb; this.wb = null; this.xb = new mboxOfferContent(); this.pb = null; this.w = w; this.message = ''; this.yb = new Object(); this.zb = 0; this.sb = sb; this.g = g; this.Ab(); w.addParameter('mbox', g) .addParameter('mboxId', sb); this.Bb = function() {}; this.Cb = function() {}; this.Db = null;};mbox.prototype.getId = function() { return this.sb;};mbox.prototype.Ab = function() { if (this.g.length > 250) { throw "Mbox Name " + this.g + " exceeds max length of " + "250 characters."; } else if (this.g.match(/^\s+|\s+$/g)) { throw "Mbox Name " + this.g + " has leading/trailing whitespace(s)."; }};mbox.prototype.getName = function() { return this.g;};mbox.prototype.getParameters = function() { var c = this.w.getParameters(); var mb = new Array(); for (var j = 0; j < c.length; j++) { if (c[j].name.indexOf('mbox') != 0) { mb[mb.length] = c[j].name + '=' + c[j].value; } } return mb;};mbox.prototype.setOnLoad = function(p) { this.Cb = p; return this;};mbox.prototype.setMessage = function(cb) { this.message = cb; return this;};mbox.prototype.setOnError = function(Bb) { this.Bb = Bb; return this;};mbox.prototype.setFetcher = function(Eb) { if (this.wb) { this.wb.cancel(); } this.wb = Eb; return this;};mbox.prototype.getFetcher = function() { return this.wb;};mbox.prototype.load = function(c) { if (this.wb == null) { return this; } this.setEventTime("load.start"); this.cancelTimeout(); this.vb = 0; var w = (c && c.length > 0) ? this.w.clone().addParameters(c) : this.w; this.wb.fetch(w); var P = this; this.Fb = setTimeout(function() { P.Bb('browser timeout', P.wb.getType()); }, 15000); this.setEventTime("load.end"); return this;};mbox.prototype.loaded = function() { this.cancelTimeout(); if (!this.activate()) { var P = this; setTimeout(function() { P.loaded(); }, 100); }};mbox.prototype.activate = function() { if (this.vb) { return this.vb; } this.setEventTime('activate' + ++this.zb + '.start'); if (this.show()) { this.cancelTimeout(); this.vb = 1; } this.setEventTime('activate' + this.zb + '.end'); return this.vb;};mbox.prototype.isActivated = function() { return this.vb;};mbox.prototype.setOffer = function(xb) { if (xb && xb.show && xb.setOnLoad) { this.xb = xb; } else { throw 'Invalid offer'; } return this;};mbox.prototype.getOffer = function() { return this.xb;};mbox.prototype.show = function() { this.setEventTime('show.start'); var mb = this.xb.show(this); this.setEventTime(mb == 1 ? "show.end.ok" : "show.end"); return mb;};mbox.prototype.showContent = function(Gb) { if (Gb == null) { return 0; } if (this.pb == null || !this.pb.parentNode) { this.pb = this.getDefaultDiv(); if (this.pb == null) { return 0; } } if (this.pb != Gb) { this.Hb(this.pb); this.pb.parentNode.replaceChild(Gb, this.pb); this.pb = Gb; } this.Ib(Gb); this.Cb(); return 1;};mbox.prototype.hide = function() { this.setEventTime('hide.start'); var mb = this.showContent(this.getDefaultDiv()); this.setEventTime(mb == 1 ? 'hide.end.ok' : 'hide.end.fail'); return mb;};mbox.prototype.finalize = function() { this.setEventTime('finalize.start'); this.cancelTimeout(); if (this.getDefaultDiv() == null) { if (this.ab.force() != null) { this.setMessage('No default content, an empty one has been added'); } else { this.setMessage('Unable to locate mbox'); } } if (!this.activate()) { this.hide(); this.setEventTime('finalize.end.hide'); } this.setEventTime('finalize.end.ok');};mbox.prototype.cancelTimeout = function() { if (this.Fb) { clearTimeout(this.Fb); } if (this.wb != null) { this.wb.cancel(); }};mbox.prototype.getDiv = function() { return this.pb;};mbox.prototype.getDefaultDiv = function() { if (this.Db == null) { this.Db = this.ab.locate(); } return this.Db;};mbox.prototype.setEventTime = function(Jb) { this.yb[Jb] = (new Date()).getTime();};mbox.prototype.getEventTimes = function() { return this.yb;};mbox.prototype.getImportName = function() { return this.bb;};mbox.prototype.getURL = function() { return this.w.buildUrl();};mbox.prototype.getUrlBuilder = function() { return this.w;};mbox.prototype.Kb = function(pb) { return pb.style.display != 'none';};mbox.prototype.Ib = function(pb) { this.Lb(pb, true);};mbox.prototype.Hb = function(pb) { this.Lb(pb, false);};mbox.prototype.Lb = function(pb, Mb) { pb.style.visibility = Mb ? "visible" : "hidden"; pb.style.display = Mb ? "block" : "none";};mboxOfferContent = function() { this.Cb = function() {};};mboxOfferContent.prototype.show = function(Q) { var mb = Q.showContent(document.getElementById(Q.getImportName())); if (mb == 1) { this.Cb(); } return mb;};mboxOfferContent.prototype.setOnLoad = function(Cb) { this.Cb = Cb;};mboxOfferAjax = function(Gb) { this.Gb = Gb; this.Cb = function() {};};mboxOfferAjax.prototype.setOnLoad = function(Cb) { this.Cb = Cb;};mboxOfferAjax.prototype.show = function(Q) { var Nb = document.createElement('div'); Nb.id = Q.getImportName(); Nb.innerHTML = this.Gb; var mb = Q.showContent(Nb); if (mb == 1) { this.Cb(); } return mb;};mboxOfferDefault = function() { this.Cb = function() {};};mboxOfferDefault.prototype.setOnLoad = function(Cb) { this.Cb = Cb;};mboxOfferDefault.prototype.show = function(Q) { var mb = Q.hide(); if (mb == 1) { this.Cb(); } return mb;};mboxCookieManager = function mboxCookieManager(g, Ob) { this.g = g; this.Ob = Ob == '' || Ob.indexOf('.') == -1 ? '' : '; domain=' + Ob; this.Pb = new mboxMap(); this.loadCookies();};mboxCookieManager.prototype.isEnabled = function() { this.setCookie('check', 'true', 60); this.loadCookies(); return this.getCookie('check') == 'true';};mboxCookieManager.prototype.setCookie = function(g, h, U) { if (typeof g != 'undefined' && typeof h != 'undefined' && typeof U != 'undefined') { var Qb = new Object(); Qb.name = g; Qb.value = escape(h); Qb.expireOn = Math.ceil(U + new Date().getTime() / 1000); this.Pb.put(g, Qb); this.saveCookies(); }};mboxCookieManager.prototype.getCookie = function(g) { var Qb = this.Pb.get(g); return Qb ? unescape(Qb.value) : null;};mboxCookieManager.prototype.deleteCookie = function(g) { this.Pb.remove(g); this.saveCookies();};mboxCookieManager.prototype.getCookieNames = function(Rb) { var Sb = new Array(); this.Pb.each(function(g, Qb) { if (g.indexOf(Rb) == 0) { Sb[Sb.length] = g; } }); return Sb;};mboxCookieManager.prototype.saveCookies = function() { var Tb = new Array(); var Ub = 0; this.Pb.each(function(g, Qb) { Tb[Tb.length] = g + '#' + Qb.value + '#' + Qb.expireOn; if (Ub < Qb.expireOn) { Ub = Qb.expireOn; } }); var Vb = new Date(Ub * 1000); document.cookie = this.g + '=' + Tb.join('|') + '; expires=' + Vb.toGMTString() + '; path=/' + this.Ob;};mboxCookieManager.prototype.loadCookies = function() { this.Pb = new mboxMap(); var Wb = document.cookie.indexOf(this.g + '='); if (Wb != -1) { var Xb = document.cookie.indexOf(';', Wb); if (Xb == -1) { Xb = document.cookie.indexOf(',', Wb); if (Xb == -1) { Xb = document.cookie.length; } } var Yb = document.cookie.substring( Wb + this.g.length + 1, Xb).split('|'); var Zb = Math.ceil(new Date().getTime() / 1000); for (var j = 0; j < Yb.length; j++) { var Qb = Yb[j].split('#'); if (Zb <= Qb[2]) { var _b = new Object(); _b.name = Qb[0]; _b.value = Qb[1]; _b.expireOn = Qb[2]; this.Pb.put(_b.name, _b); } } }};mboxSession = function(ac, bc, jb, cc, I) { this.bc = bc; this.jb = jb; this.cc = cc; this.I = I; this.dc = false; this.sb = typeof mboxForceSessionId != 'undefined' ? mboxForceSessionId : mboxGetPageParameter(this.bc); if (this.sb == null || this.sb.length == 0) { this.sb = I.getCookie(jb); if (this.sb == null || this.sb.length == 0) { this.sb = ac; this.dc = true; } } I.setCookie(jb, this.sb, cc);};mboxSession.prototype.getId = function() { return this.sb;};mboxSession.prototype.forceId = function(ec) { this.sb = ec; this.I.setCookie(this.jb, this.sb, this.cc);};mboxPC = function(jb, cc, I) { this.jb = jb; this.cc = cc; this.I = I; this.sb = typeof mboxForcePCId != 'undefined' ? mboxForcePCId : I.getCookie(jb); if (this.sb != null) { I.setCookie(jb, this.sb, cc); }};mboxPC.prototype.getId = function() { return this.sb;};mboxPC.prototype.forceId = function(ec) { if (this.sb != ec) { this.sb = ec; this.I.setCookie(this.jb, this.sb, this.cc); return true; } return false;};mboxGetPageParameter = function(g) { var mb = null; var fc = new RegExp(g + "=([^\&]*)"); var gc = fc.exec(document.location); if (gc != null && gc.length >= 2) { mb = gc[1]; } return mb;};mboxSetCookie = function(g, h, U) { return mboxFactoryDefault.getCookieManager().setCookie(g, h, U);};mboxGetCookie = function(g) { return mboxFactoryDefault.getCookieManager().getCookie(g);};mboxCookiePageDomain = function() { var Ob = (/([^:]*)(:[0-9]{0,5})?/).exec(document.location.host)[1]; var hc = /[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/; if (!hc.exec(Ob)) { var ic = (/([^\.]+\.[^\.]{3}|[^\.]+\.[^\.]+\.[^\.]{2})$/).exec(Ob); if (ic) { Ob = ic[0]; } } return Ob ? Ob: "";};mboxShiftArray = function(jc) { var mb = new Array(); for (var j = 1; j < jc.length; j++) { mb[mb.length] = jc[j]; } return mb;};mboxGenerateId = function() { return (new Date()).getTime() + "-" + Math.floor(Math.random() * 999999);};if (typeof mboxVersion == 'undefined') { var mboxVersion = 38; var mboxFactories = new mboxMap(); var mboxFactoryDefault = new mboxFactory('honda.tt.omtrdc.net', 'honda', 'default');};if (mboxGetPageParameter("mboxDebug") != null || mboxFactoryDefault.getCookieManager() .getCookie("debug") != null) { setTimeout(function() { if (typeof mboxDebugLoaded == 'undefined') { alert('Could not load the remote debug.\nPlease check your connection' + ' to Test&amp;Target servers'); } }, 60*60); document.write('<' + 'scr' + 'ipt language="Javascript1.2" src=' + '"http://admin12.testandtarget.omniture.com/admin/mbox/mbox_debug.jsp?mboxServerHost=honda.tt.omtrdc.net' + '&clientCode=honda"><' + '\/scr' + 'ipt>');};mboxScPluginFetcher = function(b, kc) { this.b = b; this.kc = kc;};mboxScPluginFetcher.prototype.lc = function(w) { w.setBasePath('/m2/' + this.b + '/sc/standard'); this.mc(w); var e = w.buildUrl(); e += '&scPluginVersion=1'; return e;};mboxScPluginFetcher.prototype.mc = function(w) { var nc = [ "dynamicVariablePrefix","visitorID","vmk","ppu","charSet", "visitorNamespace","cookieDomainPeriods","cookieLifetime","pageName", "currencyCode","variableProvider","channel","server", "pageType","transactionID","purchaseID","campaign","state","zip","events", "products","linkName","linkType","resolution","colorDepth", "javascriptVersion","javaEnabled","cookiesEnabled","browserWidth", "browserHeight","connectionType","homepage","pe","pev1","pev2","pev3", "visitorSampling","visitorSamplingGroup","dynamicAccountSelection", "dynamicAccountList","dynamicAccountMatch","trackDownloadLinks", "trackExternalLinks","trackInlineStats","linkLeaveQueryString", "linkDownloadFileTypes","linkExternalFilters","linkInternalFilters", "linkTrackVars","linkTrackEvents","linkNames","lnk","eo" ]; for (var j = 0; j < nc.length; j++) { this.oc(nc[j], w); } for (var j = 1; j <= 50; j++) { this.oc('prop' + j, w); this.oc('eVar' + j, w); this.oc('hier' + j, w); }};mboxScPluginFetcher.prototype.oc = function(g, w) { var h = this.kc[g]; if (typeof(h) === 'undefined' || h === null || h === '') { return; } w.addParameter(g, h);};mboxScPluginFetcher.prototype.cancel = function() { };mboxStandardScPluginFetcher = function(b, kc) { mboxScPluginFetcher.call(this, b, kc);};mboxStandardScPluginFetcher.prototype = new mboxScPluginFetcher;mboxStandardScPluginFetcher.prototype.getType = function() { return 'standard';};mboxStandardScPluginFetcher.prototype.fetch = function(w) { w.setServerType(this.getType()); var e = this.lc(w); document.write('<' + 'scr' + 'ipt src="' + e + '" language="JavaScript"><' + '\/scr' + 'ipt>');};mboxAjaxScPluginFetcher = function(b, kc) { mboxScPluginFetcher.call(this, b, kc);};mboxAjaxScPluginFetcher.prototype = new mboxScPluginFetcher;mboxAjaxScPluginFetcher.prototype.fetch = function(w) { w.setServerType(this.getType()); var e = this.lc(w); this.x = document.createElement('script'); this.x.src = e; document.body.appendChild(this.x);};mboxAjaxScPluginFetcher.prototype.getType = function() { return 'ajax';};function mboxLoadSCPlugin(kc) { if (!kc) { return null; } kc.m_tt = function(kc) { var pc = kc.m_i('tt'); pc.G = true; pc.b = 'honda'; pc['_t'] = function() { if (!this.isEnabled()) { return; } var Q = this.rc(); if (Q) { var Eb = mboxFactoryDefault.isDomLoaded() ? new mboxAjaxScPluginFetcher(this.b, this.s) : new mboxStandardScPluginFetcher(this.b, this.s); Q.setFetcher(Eb); Q.load(); } }; pc.isEnabled = function() { return this.G && mboxFactoryDefault.isEnabled(); }; pc.rc = function() { var T = this.sc(); var pb = document.createElement('DIV'); return mboxFactoryDefault.create(T, new Array(), pb); }; pc.sc = function() { var tc = this.s.events && this.s.events.indexOf('purchase') != -1; return 'SiteCatalyst: ' + (tc ? 'purchase' : 'event'); }; }; return kc.loadModule('tt');};

